bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] New compression function.


From: Shigio YAMAGUCHI
Subject: Re: [RFC] New compression function.
Date: Sun, 14 Feb 2010 09:41:16 +0900

Hi,
> I found a problem about GTAGS_COMPNAME.
> When GTAGS_COMPNAME is set and GTAGS_COMPACT is not set, calling like
> compress("foo::bar","bar") causes NULL pointer access in the following line. 
> 
>   203                         int i, limit = name2ab->length;

I have fixed and committed it. Thank you for the report.

P.S.
How about writing '[BUG]' etc at the title? It would be convenient when 
refferring later.

Index: compress.c
===================================================================
RCS file: /sources/global/global/libutil/compress.c,v
retrieving revision 1.8
diff -c -r1.8 compress.c
*** compress.c  24 Jan 2010 16:04:45 -0000      1.8
--- compress.c  14 Feb 2010 00:27:53 -0000
***************
*** 140,145 ****
--- 140,149 ----
        struct abbrmap *ab;
        int i, limit = sizeof(ab2name) / sizeof(struct abbrmap);
  
+       if (!name2ab) {
+               fprintf(stderr, "name2ab is NULL.\n");
+               return;
+       }
        fprintf(stderr, "ab2name: %d entries\n", limit);
        for (i = 0; i < limit; i++) {
                if (ab2name[i].c != 0) {
***************
*** 199,205 ****
                } else if (!strncmp(p, name, length)) {
                        strbuf_puts(sb, "@n");
                        p += length;
!               } else {
                        int i, limit = name2ab->length;
                        struct abbrmap *ab = (struct abbrmap 
*)varray_assign(name2ab, 0, 0);
  
--- 203,209 ----
                } else if (!strncmp(p, name, length)) {
                        strbuf_puts(sb, "@n");
                        p += length;
!               } else if (name2ab) {
                        int i, limit = name2ab->length;
                        struct abbrmap *ab = (struct abbrmap 
*)varray_assign(name2ab, 0, 0);
  
***************
*** 215,220 ****
--- 219,227 ----
                                strbuf_putc(sb, *p);
                                p++;
                        }
+               } else {
+                       strbuf_putc(sb, *p);
+                       p++;
                }
        }
        if (spaces > 0) {
--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]