NetBSD Problem Report #47553

From cheusov@tut.by  Sun Feb 10 22:26:45 2013
Return-Path: <cheusov@tut.by>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 69F3363E5A2
	for <gnats-bugs@gnats.netbsd.org>; Sun, 10 Feb 2013 22:26:45 +0000 (UTC)
Message-Id: <871ucng608.fsf@asrock.chizhovka.net>
Date: Mon, 11 Feb 2013 01:26:31 +0300
From: cheusov@tut.by
To: gnats-bugs@gnats.NetBSD.org
Subject: awk segfault: NULL dereference
X-Send-Pr-Version: 3.95

>Number:         47553
>Category:       bin
>Synopsis:       awk segfault: NULL dereference
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    cheusov
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 10 22:30:00 +0000 2013
>Closed-Date:    Sat Feb 23 00:18:26 +0000 2013
>Last-Modified:  Thu Mar 14 16:00:31 +0000 2013
>Originator:     Aleksey Cheusov
>Release:        NetBSD 6.0_STABLE
>Organization:
>Environment:
System: NetBSD asrock.chizhovka.net 6.0_STABLE NetBSD 6.0_STABLE (GENERIC) #2: Sat Feb 9 16:41:02 FET 2013 cheusov@asrock.chizhovka.net:/srv/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
strdup is given a NULL pointer.
Seen on awk from HEAD and netbsd-6.

core file and awk executable for NetBSD/x86-64 is here
http://mova.org/~cheusov/priv/awk_sigsegv.tar.bz2

#0  0x00007f7ff74db104 in strdup () from /usr/lib/libc.so.12
#1  0x000000000041602c in tostring (s=0x0) at /home/cheusov/prjs/nbawk/bin/../dist/tran.c:441
#2  0x0000000000415b09 in setsval (vp=0x7f7ff73dc280, s=0x0) at /home/cheusov/prjs/nbawk/bin/../dist/tran.c:361
#3  0x0000000000411d99 in instat (a=0x7f7ff6f5a5c8, n=288) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:1478
#4  0x000000000040d5ab in execute (u=0x7f7ff6f5a3d0) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:166
#5  0x0000000000411995 in ifstat (a=0x7f7ff6f5ab98, n=301) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:1394
#6  0x000000000040d5ab in execute (u=0x7f7ff6f0a3a0) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:166
#7  0x000000000040dcf7 in call (a=0x7f7ff6fb9b78, n=333) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:289
#8  0x000000000040d5ab in execute (u=0x7f7ff6fb9b60) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:166
#9  0x0000000000411a45 in whilestat (a=0x7f7ff6fb9ba8, n=342) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:1411
#10 0x000000000040d5ab in execute (u=0x7f7ff6fb9b90) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:166
#11 0x0000000000411995 in ifstat (a=0x7f7ff6fb9d28, n=301) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:1394
#12 0x000000000040d5ab in execute (u=0x7f7ff7b44800) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:166
#13 0x000000000040d689 in program (a=0x7f7ff6fdfb18, n=258) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:189
#14 0x000000000040d5ab in execute (u=0x7f7ff6fdfb00) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:166
#15 0x000000000040d497 in run (a=0x7f7ff6fdfb00) at /home/cheusov/prjs/nbawk/bin/../dist/run.c:141
#16 0x000000000040c915 in main (argc=5, argv=0x7f7fffffca90) at /home/cheusov/prjs/nbawk/bin/../dist/main.c:235
>How-To-Repeat:
original script and input data is rather big.
I hope core file is enough.
>Fix:
        <how to correct or work around the problem, if known (multiple lines)>

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47553 CVS commit: src/external/historical/nawk/dist
Date: Sun, 10 Feb 2013 19:32:09 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Mon Feb 11 00:32:08 UTC 2013

 Modified Files:
 	src/external/historical/nawk/dist: tran.c

 Log Message:
 PR/47553: Aleksev Cheusov: awk segfault: NULL dereference.


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/external/historical/nawk/dist/tran.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 11 Feb 2013 11:55:20 +0000
State-Changed-Why:
christos committed a fix -- ok now?


Responsible-Changed-From-To: bin-bug-people->cheusov
Responsible-Changed-By: cheusov@NetBSD.org
Responsible-Changed-When: Mon, 11 Feb 2013 17:20:16 +0000
Responsible-Changed-Why:
Christos applied a workaround that fixes crash
but I'm not sure my script works correctly.
At least I see a difference between awk and gawk|mawk.
I'll analyse it as soon as I have time.


State-Changed-From-To: feedback->closed
State-Changed-By: cheusov@NetBSD.org
State-Changed-When: Sat, 23 Feb 2013 00:18:26 +0000
State-Changed-Why:
Fixed. Thanks Christos!


From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47553 CVS commit: [netbsd-6] src/external/historical/nawk/dist
Date: Thu, 14 Mar 2013 15:54:59 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Thu Mar 14 15:54:58 UTC 2013

 Modified Files:
 	src/external/historical/nawk/dist [netbsd-6]: tran.c

 Log Message:
 Pull up following revision(s) (requested by cheusov in ticket #836):
 	external/historical/nawk/dist/tran.c: revision 1.8
 PR/47553: Aleksev Cheusov: awk segfault: NULL dereference.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.5.6.1 src/external/historical/nawk/dist/tran.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47553 CVS commit: [netbsd-6-0] src/external/historical/nawk/dist
Date: Thu, 14 Mar 2013 15:55:11 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Thu Mar 14 15:55:11 UTC 2013

 Modified Files:
 	src/external/historical/nawk/dist [netbsd-6-0]: tran.c

 Log Message:
 Pull up following revision(s) (requested by cheusov in ticket #836):
 	external/historical/nawk/dist/tran.c: revision 1.8
 PR/47553: Aleksev Cheusov: awk segfault: NULL dereference.


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.5.12.1 src/external/historical/nawk/dist/tran.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.