Opened 16 years ago

Closed 16 years ago

#356 closed defect (fixed)

g.parser buffer overflow terminates shell script

Reported by: epatton Owned by: grass-dev@…
Priority: major Milestone: 6.4.0
Component: Default Version: svn-develbranch6
Keywords: g.parser, buffer overflow Cc:
CPU: x86-64 Platform: Linux

Description

Hi,

Running one of my own shell scripts for the first time in a while, and it appears that g.parser is choking on the shell command call. I ran the script in sh -x mode for extra output:

~/Projects/99020/PERMANENT/databases >v.nav.interp -g input=Vect_Cruise_99020_Camera_Starts_and_Stops time_col=Timestamp east_col=Easting north_col=Northing list=Timestamps_Required.txt cats=1,2

+ basename /home/epatton/coderepo/v.nav.interp
+ SCRIPT=v.nav.interp
+ [ -z /usr/local/grass-6.4.svn ]
+ [ -g != @ARGS_PARSED@ ]
+ exec g.parser /home/epatton/coderepo/v.nav.interp -g input=Vect_Cruise_99020_Camera_Starts_and_Stops time_col=Timestamp east_col=Easting north_col=Northing list=Timestamps_Required.txt cats=1,2
*** buffer overflow detected ***: g.parser terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f7aff9a6887]
/lib/libc.so.6[0x7f7aff9a4750]
/lib/libc.so.6[0x7f7aff9a3ae9]
/lib/libc.so.6(_IO_default_xsputn+0x96)[0x7f7aff91f116]
/lib/libc.so.6(_IO_vfprintf+0x1c1c)[0x7f7aff8f029c]
/lib/libc.so.6(__vsprintf_chk+0x9d)[0x7f7aff9a3b8d]
/lib/libc.so.6(__sprintf_chk+0x80)[0x7f7aff9a3ad0]
g.parser(main+0x339)[0x401559]
/lib/libc.so.6(__libc_start_main+0xe6)[0x7f7aff8c5466]
g.parser[0x401089]
======= Memory map: ========
00400000-00403000 r-xp 00000000 08:03 985046                             /usr/local/grass-6.4.svn/bin/g.parser
00602000-00603000 r--p 00002000 08:03 985046                             /usr/local/grass-6.4.svn/bin/g.parser
00603000-00604000 rw-p 00003000 08:03 985046                             /usr/local/grass-6.4.svn/bin/g.parser
00afc000-00b1d000 rw-p 00afc000 00:00 0                                  [heap]
7f7aff48b000-7f7aff4a1000 r-xp 00000000 08:03 449691                     /lib/libgcc_s.so.1
7f7aff4a1000-7f7aff6a1000 ---p 00016000 08:03 449691                     /lib/libgcc_s.so.1
7f7aff6a1000-7f7aff6a2000 r--p 00016000 08:03 449691                     /lib/libgcc_s.so.1
7f7aff6a2000-7f7aff6a3000 rw-p 00017000 08:03 449691                     /lib/libgcc_s.so.1
7f7aff6a3000-7f7aff6a5000 r-xp 00000000 08:03 449733                     /lib/libdl-2.8.90.so
7f7aff6a5000-7f7aff8a5000 ---p 00002000 08:03 449733                     /lib/libdl-2.8.90.so
7f7aff8a5000-7f7aff8a6000 r--p 00002000 08:03 449733                     /lib/libdl-2.8.90.so
7f7aff8a6000-7f7aff8a7000 rw-p 00003000 08:03 449733                     /lib/libdl-2.8.90.so
7f7aff8a7000-7f7affa10000 r-xp 00000000 08:03 449718                     /lib/libc-2.8.90.so
7f7affa10000-7f7affc0f000 ---p 00169000 08:03 449718                     /lib/libc-2.8.90.so
7f7affc0f000-7f7affc13000 r--p 00168000 08:03 449718                     /lib/libc-2.8.90.so
7f7affc13000-7f7affc14000 rw-p 0016c000 08:03 449718                     /lib/libc-2.8.90.so
7f7affc14000-7f7affc19000 rw-p 7f7affc14000 00:00 0 
7f7affc19000-7f7affc9d000 r-xp 00000000 08:03 449752                     /lib/libm-2.8.90.so
7f7affc9d000-7f7affe9c000 ---p 00084000 08:03 449752                     /lib/libm-2.8.90.so
7f7affe9c000-7f7affe9d000 r--p 00083000 08:03 449752                     /lib/libm-2.8.90.so
7f7affe9d000-7f7affe9e000 rw-p 00084000 08:03 449752                     /lib/libm-2.8.90.so
7f7affe9e000-7f7affeb5000 r-xp 00000000 08:03 935654                     /usr/lib/libz.so.1.2.3.3
7f7affeb5000-7f7b000b4000 ---p 00017000 08:03 935654                     /usr/lib/libz.so.1.2.3.3
7f7b000b4000-7f7b000b6000 rw-p 00016000 08:03 935654                     /usr/lib/libz.so.1.2.3.3
7f7b000b6000-7f7b000be000 r-xp 00000000 08:03 426761                     /usr/local/grass-6.4.svn/lib/libgrass_datetime.6.4.svn.so
7f7b000be000-7f7b002bd000 ---p 00008000 08:03 426761                     /usr/local/grass-6.4.svn/lib/libgrass_datetime.6.4.svn.so
7f7b002bd000-7f7b002be000 r--p 00007000 08:03 426761                     /usr/local/grass-6.4.svn/lib/libgrass_datetime.6.4.svn.so
7f7b002be000-7f7b002bf000 rw-p 00008000 08:03 426761                     /usr/local/grass-6.4.svn/lib/libgrass_datetime.6.4.svn.so
7f7b002bf000-7f7b00311000 r-xp 00000000 08:03 426729                     /usr/local/grass-6.4.svn/lib/libgrass_gis.6.4.svn.so
7f7b00311000-7f7b00511000 ---p 00052000 08:03 426729                     /usr/local/grass-6.4.svn/lib/libgrass_gis.6.4.svn.so
7f7b00511000-7f7b00512000 r--p 00052000 08:03 426729                     /usr/local/grass-6.4.svn/lib/libgrass_gis.6.4.svn.so
7f7b00512000-7f7b00514000 rw-p 00053000 08:03 426729                     /usr/local/grass-6.4.svn/lib/libgrass_gis.6.4.svn.so
7f7b00514000-7f7b00519000 rw-p 7f7b00514000 00:00 0 
7f7b00519000-7f7b00538000 r-xp 00000000 08:03 449698                     /lib/ld-2.8.90.so
7f7b00713000-7f7b00716000 rw-p 7f7b00713000 00:00 0 
7f7b00733000-7f7b00737000 rw-p 7f7b00733000 00:00 0 
7f7b00737000-7f7b00738000 r--p 0001e000 08:03 449698                     /lib/ld-2.8.90.so
7f7b00738000-7f7b00739000 rw-p 0001f000 08:03 449698                     /lib/ld-2.8.90.so
7fff08722000-7fff08738000 rw-p 7ffffffe9000 00:00 0                      [stack]
7fff087fd000-7fff087fe000 r-xp 7fff087fd000 00:00 0                      [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted

Any relation to recent changes to g.parser in Trac?

~ Eric.

Change History (2)

in reply to:  description comment:1 by glynn, 16 years ago

Replying to epatton:

Running one of my own shell scripts for the first time in a while, and it appears that g.parser is choking on the shell command call.

* buffer overflow detected *: g.parser terminated

Any relation to recent changes to g.parser in Trac?

It may have been triggered by those changes, but I don't think that it's actually caused by them.

I did find an undersized buffer, which has been fixed in r34172 (7.0) and r34173 (6.4).

comment:2 by epatton, 16 years ago

Resolution: fixed
Status: newclosed

Thanks, Glynn. Your fix has solved the problem!

Note: See TracTickets for help on using tickets.