From owner-svn-src-stable-10@freebsd.org Sun Sep 13 13:31:53 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47255A039F7; Sun, 13 Sep 2015 13:31:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 368FB1DBE; Sun, 13 Sep 2015 13:31:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8DDVrJK069040; Sun, 13 Sep 2015 13:31:53 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8DDVqcs069034; Sun, 13 Sep 2015 13:31:52 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509131331.t8DDVqcs069034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 13 Sep 2015 13:31:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r287749 - in stable/10/bin/sh: . tests/errors X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 13:31:53 -0000 Author: jilles Date: Sun Sep 13 13:31:51 2015 New Revision: 287749 URL: https://svnweb.freebsd.org/changeset/base/287749 Log: MFC r287081: sh: Don't create bad parse result when postponing a bad substitution error. An invalid substitution like ${var@} does not cause a parse error but is stored in the intermediate representation, to be written as part of the error message. If there is a CTL* byte in the stored part, this confuses some code such as the code to skip an unused alternative such as in ${var-alternative}. To keep things simple, do not store CTL* bytes. Found with afl-fuzz. Added: stable/10/bin/sh/tests/errors/bad-parm-exp7.0 - copied unchanged from r287081, head/bin/sh/tests/errors/bad-parm-exp7.0 stable/10/bin/sh/tests/errors/bad-parm-exp8.0 - copied unchanged from r287081, head/bin/sh/tests/errors/bad-parm-exp8.0 Modified: stable/10/bin/sh/parser.c stable/10/bin/sh/tests/errors/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/parser.c ============================================================================== --- stable/10/bin/sh/parser.c Sun Sep 13 13:00:20 2015 (r287748) +++ stable/10/bin/sh/parser.c Sun Sep 13 13:31:51 2015 (r287749) @@ -1671,7 +1671,7 @@ varname: pungetc(); else if (c == '\n' || c == PEOF) synerror("Unexpected end of line in substitution"); - else + else if (BASESYNTAX[c] != CCTL) USTPUTC(c, out); } if (subtype == 0) { @@ -1687,7 +1687,8 @@ varname: synerror("Unexpected end of line in substitution"); if (flags == VSNUL) STPUTC(':', out); - STPUTC(c, out); + if (BASESYNTAX[c] != CCTL) + STPUTC(c, out); subtype = VSERROR; } else subtype = p - types + VSNORMAL; Modified: stable/10/bin/sh/tests/errors/Makefile ============================================================================== --- stable/10/bin/sh/tests/errors/Makefile Sun Sep 13 13:00:20 2015 (r287748) +++ stable/10/bin/sh/tests/errors/Makefile Sun Sep 13 13:31:51 2015 (r287749) @@ -17,6 +17,8 @@ FILES+= bad-parm-exp3.2 bad-parm-exp3.2 FILES+= bad-parm-exp4.2 bad-parm-exp4.2.stderr FILES+= bad-parm-exp5.2 bad-parm-exp5.2.stderr FILES+= bad-parm-exp6.2 bad-parm-exp6.2.stderr +FILES+= bad-parm-exp7.0 +FILES+= bad-parm-exp8.0 FILES+= option-error.0 FILES+= redirection-error.0 FILES+= redirection-error2.2 Copied: stable/10/bin/sh/tests/errors/bad-parm-exp7.0 (from r287081, head/bin/sh/tests/errors/bad-parm-exp7.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/errors/bad-parm-exp7.0 Sun Sep 13 13:31:51 2015 (r287749, copy of r287081, head/bin/sh/tests/errors/bad-parm-exp7.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=1 +eval ": $(printf '${v-${\372}}')" Copied: stable/10/bin/sh/tests/errors/bad-parm-exp8.0 (from r287081, head/bin/sh/tests/errors/bad-parm-exp8.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/errors/bad-parm-exp8.0 Sun Sep 13 13:31:51 2015 (r287749, copy of r287081, head/bin/sh/tests/errors/bad-parm-exp8.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=1 +eval ": $(printf '${v-${w\372}}')"