"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: crash in 'got log' (no reliable way to reproduce)
To:
Omar Polo <op@omarpolo.com>
Cc:
Mikhail <mp39590@gmail.com>, gameoftrees@openbsd.org
Date:
Sat, 01 Apr 2023 16:53:04 +0200

Download raw body.

Thread
re-trying (hopefully) without quoted-printable ;-)

On 2023/04/01 13:45:03 +0200, Omar Polo <op@omarpolo.com> wrote:
> On 2023/04/01 13:04:53 +0300, Mikhail <mp39590@gmail.com> wrote:
> > core:/sys$ got log -p  dev/pci/if_iwx.c  | less
> > /updatechan
> > n
> > n
> > (i suspect next pressings should be done quickly)
> > <ctrl-c>
> > q
> > 
> > Core is here: https://people.freebsd.org/~misha/got.core
> 
> Haven't tried to reproduce with this recipe, but looking at the
> stacktrace it seems that blob is NULL and got_object_blob_close
> doesn't like it.
> 
> > Reading symbols from got...
> > [New process 31956]
> > Core was generated by `got'.
> > Program terminated with signal SIGSEGV, Segmentation fault.
> > #0  0x0000030e9bd80ec5 in got_object_blob_close (blob=0x0) at /home/misha/work/got/got/../lib/object.c:360
> > 360             free(blob->read_buf);
> > gef➤  bt
> > #0  0x0000030e9bd80ec5 in got_object_blob_close (blob=0x0) at /home/misha/work/got/got/../lib/object.c:360
> > #1  0x0000030e9bd6427a in diff_blobs (blob_id1=0x3116c2de400, blob_id2=0x3116c2decc0, path=0x310f0af3480 "//sys/dev/pci/if_iwx.c", diff_context=0x3, ignore_whitespace=0x0, force_text_diff=0x0, dsa=0x0,
> >     repo=0x310bb102460, outfile=0x31158fac818 <__sF+152>) at /home/misha/work/got/got/got.c:3711
> 
> So I guess the issue is here.  We should guard
> got_object_blob_close(blob2) like with do with blob1.

diff -s /home/op/w/got
commit - f9b5f5fbdf2ae49a4e217212d261d89d83dacd7e
path + /home/op/w/got (staged changes)
blob - a51a450a06ab2800d2fe4a200fc31cc59364dac6
blob + 8ff7e074110ce8eb022c3fee11169b99a0e583fe
--- got/got.c
+++ got/got.c
@@ -3708,7 +3708,8 @@ done:
 		got_object_blob_close(blob1);
 	if (fd2 != -1 && close(fd2) == -1 && err == NULL)
 		err = got_error_from_errno("close");
-	got_object_blob_close(blob2);
+	if (blob2)
+		got_object_blob_close(blob2);
 	if (f1 && fclose(f1) == EOF && err == NULL)
 		err = got_error_from_errno("fclose");
 	if (f2 && fclose(f2) == EOF && err == NULL)