Crash in global search
Andrew Ng <[email protected]> Thu, 28 Feb 2019 14:18:08 +0000
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <CADbiGS5arN1Z4vcDW=ji1QiDostLVJgQs39s7VGf2wrpwvLuuw@mail.gmail.com> |
Hi, With the latest source, I'm seeing a crash in global when doing a search, e.g. global -s -t <sym> I have traced it down to "uncompress" when "sb_compress" is NULL because "abbrev_open" has not been called. I've attached a potential fix for this issue which is to explicitly pass a STRBUF to "uncompress" in "output.c". Cheers, Andrew _______________________________________________ Bug-global mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-global
patch.diff
(application/octet-stream, 1.7 KB)
Index: global/output.c
===================================================================
RCS file: /sources/global/global/global/output.c,v
retrieving revision 1.8
diff -u -r1.8 output.c
--- global/output.c 22 Feb 2019 04:33:29 -0000 1.8
+++ global/output.c 28 Feb 2019 14:09:24 -0000
@@ -43,6 +43,8 @@
extern int nosource;
extern int format;
+static STRBUF *sb_uncompress;
+
/** get next number and seek to the next character */
#define GET_NEXT_NUMBER(p) do { \
if (!isdigit(*p)) \
@@ -58,10 +60,13 @@
cur_lineno = last_lineno = 0;
fp = NULL;
src = "";
+ sb_uncompress = strbuf_open(0);
}
void
end_output(void)
{
+ if (sb_uncompress)
+ strbuf_close(sb_uncompress);
if (fp)
fclose(fp);
}
@@ -146,7 +151,7 @@
if (!isdigit(*p))
die("invalid compact format.");
if (flags & GTAGS_COMPNAME)
- tagname = (char *)uncompress(tagname, gtp->tag, NULL);
+ tagname = (char *)uncompress(tagname, gtp->tag, sb_uncompress);
if (flags & GTAGS_COMPLINE) {
/*
* If GTAGS_COMPLINE flag is set, each line number is expressed as
@@ -240,7 +245,7 @@
p++;
*p++ = '\0'; /* b */
if (flags & GTAGS_COMPNAME) {
- strlimcpy(namebuf, (char *)uncompress(tagname, gtp->tag, NULL), sizeof(namebuf));
+ strlimcpy(namebuf, (char *)uncompress(tagname, gtp->tag, sb_uncompress), sizeof(namebuf));
tagname = namebuf;
}
if (nosource) {
@@ -250,7 +255,7 @@
p++;
image = p + 1; /* c + 1 */
if (flags & GTAGS_COMPRESS)
- image = (char *)uncompress(image, gtp->tag, NULL);
+ image = (char *)uncompress(image, gtp->tag, sb_uncompress);
}
convert_put_using(cv, tagname, gtp->path, gtp->lineno, image, fid);
}