From nobody  Wed Apr 29 12:51:30 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id MAA13127;
          Wed, 29 Apr 1998 12:51:30 -0700 (PDT)
          (envelope-from nobody)
Message-Id: <199804291951.MAA13127@hub.freebsd.org>
Date: Wed, 29 Apr 1998 12:51:30 -0700 (PDT)
From: Elmar.Bartel@informatik.tu-muenchen.de
To: freebsd-gnats-submit@freebsd.org
Subject: sed is not 8bit-clean on y-command
X-Send-Pr-Version: www-1.0

>Number:         6458
>Category:       bin
>Synopsis:       sed is not 8bit-clean on y-command
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 29 13:00:01 PDT 1998
>Closed-Date:    Wed Apr 29 14:58:43 PDT 1998
>Last-Modified:  Wed Apr 29 14:59:13 PDT 1998
>Originator:     Elmar Bartel
>Release:        2.2.6
>Organization:
Technische Universitt Mnchen
>Environment:
Not relevant

>Description:
The implementation of the 
'y' command relies on the fact, that all input charactes have
positive value. If fed with a character with value beyond 127 it
is interpreted as a negative index to the constructed translation array.
>How-To-Repeat:
echo  | sed -e y//a/

Youy won't get the expected 'a' as output (probably a 0-byte instead).
>Fix:
--- /tmp/process.c      Wed Apr 29 21:45:04 1998
+++ /tmp/process.c.new  Wed Apr 29 21:46:20 1998
@@ -240,7 +240,7 @@
                                if (pd)
                                        break;
                                for (p = ps, len = psl; --len; ++p)
-                                       *p = cp->u.y[*p];
+                                       *p = cp->u.y[*(unsigned char*)p];
                                break;
                        case ':':
                        case '}':

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ache 
State-Changed-When: Wed Apr 29 14:58:43 PDT 1998 
State-Changed-Why:  
Different fix applied 
>Unformatted:
