NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/47306: awk: segmentation fault (cat -> execute -> array)
>Number: 47306
>Category: bin
>Synopsis: awk: segmentation fault (cat -> execute -> array)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Dec 10 14:05:00 +0000 2012
>Originator: Aleksey Cheusov
>Release: NetBSD 6.0.0_PATCH
>Organization:
>Environment:
System: NetBSD cheusov.imb.invention.com 6.0.0_PATCH NetBSD 6.0.0_PATCH
(GENERIC) #3: Fri Dec 7 11:55:38 FET 2012
cheusov%cheusov.imb.invention.com@localhost:/srv/obj/sys/arch/i386/compile/GENERIC
i386
Architecture: i386
Machine: i386
>Description:
awk segfaults, see "How-To-Repeat:" section.
The problem is SUBSEP variable is first initialized in tran.c:syminit
and then '\034' is replaced with NULL here
setfval (vp=0xbb913240, f=2)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/tran.c:311
311 vp->tval &= ~STR; /* mark string invalid */
(gdb) bt
#0 setfval (vp=0xbb913240, f=2)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/tran.c:311
#1 0x0805444e in incrdecr (a=0xbb91a290, n=326)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:1099
#2 0x08052345 in execute (u=0xbb91a280)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#3 0x080546f1 in cat (a=0xbb91a2d0, q=343)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:1174
#4 0x08052345 in execute (u=0xbb91a2c0)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#5 0x080546e3 in cat (a=0xbb91a370, q=343)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:1173
#6 0x08052345 in execute (u=0xbb91a360)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#7 0x08052a0c in array (a=0xbb91a390, n=264)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:477
#8 0x08052345 in execute (u=0xbb91a380)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#9 0x08054494 in assign (a=0xbb91a3d0, n=312)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:1111
#10 0x08052345 in execute (u=0xbb91a3c0)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#11 0x080547f2 in pastat (a=0xbb91a3f0, n=259)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:1203
#12 0x08052345 in execute (u=0xbb91a3e0)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#13 0x08052daa in program (a=0xbb91a410, n=258)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:198
#14 0x08052345 in execute (u=0xbb91a400)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#15 0x08055d0f in run (a=0xbb91a400)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:141
#16 0x0805186f in main (argc=1, argv=<optimized out>)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/main.c:219
(gdb)
>How-To-Repeat:
0 cheusov>cat > in
1
1 2
0 cheusov>awk '1{ arr[$1 SUBSEP $2 SUBSEP ++cnt[$1]]=1}' < in
Segmentation fault (core dumped)
139 cheusov>gdb -q awk awk.core
Reading symbols from /usr/bin/awk...Reading symbols from
/usr/libdata/debug/usr/bin/awk.debug...done.
done.
[New process 1]
Core was generated by `awk'.
Program terminated with signal 11, Segmentation fault.
#0 0x080529be in array (a=0xbb91d330, n=264)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:469
469 int nsub = strlen(*SUBSEP);
(gdb) bt
#0 0x080529be in array (a=0xbb91d330, n=264)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:469
#1 0x08052345 in execute (u=0xbb91d320)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#2 0x080546f1 in cat (a=0xbb91d350, q=343)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:1174
#3 0x08052345 in execute (u=0xbb91d340)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#4 0x08052a0c in array (a=0xbb91d370, n=264)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:477
#5 0x08052345 in execute (u=0xbb91d360)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#6 0x08054494 in assign (a=0xbb91d3b0, n=312)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:1111
#7 0x08052345 in execute (u=0xbb91d3a0)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#8 0x080547f2 in pastat (a=0xbb91d3d0, n=259)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:1203
#9 0x08052345 in execute (u=0xbb91d3c0)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#10 0x08052daa in program (a=0xbb91d3f0, n=258)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:198
#11 0x08052345 in execute (u=0xbb91d3e0)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:166
#12 0x08055d0f in run (a=0xbb91d3e0)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:141
#13 0x0805186f in main (argc=1, argv=<optimized out>)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/main.c:219
(gdb) frame 0
#0 0x080529be in array (a=0xbb91d330, n=264)
at /srv/src_netbsd6/external/historical/nawk/bin/../dist/run.c:469
469 int nsub = strlen(*SUBSEP);
(gdb) p SUBSEP
$1 = (char **) 0xbb913248
(gdb) p *SUBSEP
$2 = 0x0
(gdb) q
0 cheusov>
>Fix:
Home |
Main Index |
Thread Index |
Old Index