From nobody@FreeBSD.org  Mon Jan  3 19:53:20 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE5E3106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  3 Jan 2011 19:53:20 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id BDDC48FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  3 Jan 2011 19:53:20 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p03JrKEs023973
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 3 Jan 2011 19:53:20 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p03JrK1w023972;
	Mon, 3 Jan 2011 19:53:20 GMT
	(envelope-from nobody)
Message-Id: <201101031953.p03JrK1w023972@red.freebsd.org>
Date: Mon, 3 Jan 2011 19:53:20 GMT
From: Olivier <bugs-freebsd@interfasys.co.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: awk segfaults when trying to extract a combination of special characters
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         153659
>Category:       bin
>Synopsis:       awk(1) segfaults when trying to extract a combination of special characters
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 03 20:00:29 UTC 2011
>Closed-Date:    
>Last-Modified:  Thu Jan  6 17:30:14 UTC 2011
>Originator:     Olivier
>Release:        8.1
>Organization:
interfaSys Ltd
>Environment:
FreeBSD 8.1-STABLE FreeBSD 8.1-STABLE #0 r213396 amd64

>Description:
awk seg faults when it has to deal with at least one sequence of characters.
This makes it crash: %*
I don't know if it happens with other combinations
>How-To-Repeat:
# edit conf
Type this
GPG_PW='%*'

# edit awk_test.sh
Type this
awk '/^[ \t]*GPG_PW[ \t=]/{\
        sub(/^[ \t]*GPG_PW[ \t]*=*/,"",$0);\
        gsub(/^[ \t]*[\047"]|[\047"][ \t]*$/,"",$0);\
        printf $0; exit}' "$1"


Now try to extract GPG_PW
# ./awk_test.sh conf

You will get this:
./awk_test.sh: line 4: 18676 Segmentation fault: 11  (core dumped) awk '/^[ \t]*GPG_PW[ \t=]/{\
        sub(/^[ \t]*GPG_PW[ \t]*=*/,"",$0);\
        gsub(/^[ \t]*[\047"]|[\047"][ \t]*$/,"",$0);\
        printf $0; exit}' "$1"

>Fix:
I'm not aware of any fixes

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-amd64->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Jan 4 02:50:50 UTC 2011 
Responsible-Changed-Why:  
reclassify. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=153659 

From: "Pedro F. Giffuni" <giffunip@tutopia.com>
To: bug-followup@FreeBSD.org, bugs-freebsd@interfasys.co.uk
Cc:  
Subject: Re: bin/153659: awk(1) segfaults when trying to extract a combination of special characters
Date: Thu, 6 Jan 2011 09:29:35 -0800 (PST)

 FWIW;
 
 This didn't segfault on i386 (8.2-RC1).
 
 Perhaps you could try the lang/nawk port?
 It's a more recent version than the awk
 in base.
 
 
       
>Unformatted:
