bug-global
[Top][All Lists]
Advanced

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

Re: [Global-commit] global/libutil conf.c strbuf.c strbuf.h


From: Hideki IWAMOTO
Subject: Re: [Global-commit] global/libutil conf.c strbuf.c strbuf.h
Date: Mon, 30 Nov 2015 21:38:03 +0900

Hi. Yamaguchi san.

I found a bug in strbuf_fgets().

When STRBUF_SHARPSKIP flag is set, and the line read by fgets() by
starts with '#', and EOL is not read because of not enough buffer,
the remaining part of the line is not skipped.


"c\n" in the next example should be skipped, but it is not skipped.


Breakpoint 2, strbuf_fgets (sb=0x5db3a0, ip=0x5db160, flags=7) at strbuf.c:357
357                     if (flags & STRBUF_SHARPSKIP && *(sb->curp) == '#')
1: *sb = {name = 0x0,
  sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting to 
use Exuberant Ctags plug-in 
parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"...,
 endp = 0x5dc010 "",
  curp = 0x5dbfc6 "\t:langmap=VHDL\\:.vhdl.vhd:\\\n", sbufsize = 1664}
(gdb)
Continuing.

Breakpoint 2, strbuf_fgets (sb=0x5db3a0, ip=0x5db160, flags=7) at strbuf.c:357
357                     if (flags & STRBUF_SHARPSKIP && *(sb->curp) == '#')
1: *sb = {name = 0x0,
  sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting to 
use Exuberant Ctags plug-in 
parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"...,
 endp = 0x5dc010 "",
  curp = 0x5dbfe0 "# Unsupported: vimrc [._]vimrc gvimrc [._]gvimr", sbufsize = 
1664}
(gdb) n
107       return __fgets_alias (__s, __n, __stream);
1: *sb = {name = 0x0,
  sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting to 
use Exuberant Ctags plug-in 
parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"...,
 endp = 0x5dc010 "",
  curp = 0x5dbfe0 "# Unsupported: vimrc [._]vimrc gvimrc [._]gvimr", sbufsize = 
1664}
(gdb)
352                     if (!fgets(sb->curp, sb->endp - sb->curp, ip)) {
1: *sb = {name = 0x0,
  sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting to 
use Exuberant Ctags plug-in 
parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"...,
 endp = 0x5dc010 "", curp = 0x5dbfe0 "c\n",
  sbufsize = 1664}
(gdb)

Breakpoint 2, strbuf_fgets (sb=0x5db3a0, ip=0x5db160, flags=7) at strbuf.c:357
357                     if (flags & STRBUF_SHARPSKIP && *(sb->curp) == '#')
1: *sb = {name = 0x0,
  sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting to 
use Exuberant Ctags plug-in 
parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"...,
 endp = 0x5dc010 "", curp = 0x5dbfe0 "c\n",
  sbufsize = 1664}
(gdb)
359                     sb->curp += strlen(sb->curp);
1: *sb = {name = 0x0,
  sbuf = 0x5db990 "universal-ctags|exuberant-ctags|plugin-example|setting to 
use Exuberant Ctags plug-in 
parser:\t:tc=common:\t:langmap=Ada\\:.adb.ads.Ada:\t:langmap=Asm\\:.asm.ASM.s.S.A51.29k.29K:\t:langmap=Asp\\:.asp.asa:\t:l"...,
 endp = 0x5dc010 "", curp = 0x5dbfe0 "c\n",
  sbufsize = 1664}
(gdb)


On Mon, 11 Jul 2011 03:21:31 +0000
Shigio YAMAGUCHI <address@hidden> wrote:

> CVSROOT:      /sources/global
> Module name:  global
> Changes by:   Shigio YAMAGUCHI <shigio>       11/07/11 03:21:31
> 
> Modified files:
>       libutil        : conf.c strbuf.c strbuf.h 
> 
> Log message:
>       o gtags.conf: The lines which start with a '#' on the continuation 
> lines is considered
>         to be a comment line.
>       
>         [example]
>               :langmap=C\:.c:\
>       #       :langmap=C#\:.cs:\
>               :langmap=Java\:.java:
>       
>         [old]
>         considered as:|      :langmap=C\:.c:#        :langmap=C#\:.cs:        
> :langmap=Java\:.java:|
>         [new]
>         considered as:|      :langmap=C\:.c:        :langmap=Java\:.java:|
> 
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/global/libutil/conf.c?cvsroot=global&r1=1.58&r2=1.59
> http://cvs.savannah.gnu.org/viewcvs/global/libutil/strbuf.c?cvsroot=global&r1=1.38&r2=1.39
> http://cvs.savannah.gnu.org/viewcvs/global/libutil/strbuf.h?cvsroot=global&r1=1.26&r2=1.27
> 
> _______________________________________________
> Global-commit mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/global-commit





reply via email to

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