From nobody@FreeBSD.org  Tue Dec  2 12:56:19 2008
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 753E21065672
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Dec 2008 12:56:19 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 60FB98FC1F
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Dec 2008 12:56:19 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2CuIqq012252
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 2 Dec 2008 12:56:18 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id mB2CuIJH012249;
	Tue, 2 Dec 2008 12:56:18 GMT
	(envelope-from nobody)
Message-Id: <200812021256.mB2CuIJH012249@www.freebsd.org>
Date: Tue, 2 Dec 2008 12:56:18 GMT
From: Mathieu Virbel <mathieu.virbel@netasq.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sed: invalid output (memory dump) with invalid regexp and \1
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         129370
>Category:       bin
>Synopsis:       sed: invalid output (memory dump) with invalid regexp and \1
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 02 13:00:01 UTC 2008
>Closed-Date:    Tue Dec 02 17:05:36 UTC 2008
>Last-Modified:  Tue Dec 02 17:05:36 UTC 2008
>Originator:     Mathieu Virbel
>Release:        7.0-STABLE
>Organization:
NETASQ
>Environment:
FreeBSD quark 7.0-STABLE FreeBSD 7.0-STABLE #1: Thu Oct  9 16:19:45 CEST 2008     root@quark:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
Instead of report an invalid regexp error, sed abort anormaly when we doing bad things like :

Command: echo 'a' | sed 's/^a/\1/'
Result: sed: realloc: Cannot allocate memory

Command: echo 'aa' | sed 's/^a/\1/'
Result: (@(@(@(@(@(@(@(@(@(@(@(@(@(@(... << memory dump.


What we would like to have
--------------------------

Command: echo 'a' | sed 's/^a/\1/'
Result: sed: -e expression #1, char 8: invalid reference \1 on `s' command's RHS
>How-To-Repeat:
Try one of these :
- echo 'a' | sed 's/^a/\1/'
- echo 'aa' | sed 's/^a/\1/'
>Fix:


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: hrs 
State-Changed-When: Tue Dec 2 17:02:05 UTC 2008 
State-Changed-Why:  
Try the latest 8-CURRENT or 7-STABLE (after Nov 20, 2008).  This issue was 
already reported in bin/126682 and a workaround has been committed. 
If you still have the same symptom after upgrading, please report 
again.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=129370 
>Unformatted:
