Date: Sun, 13 Sep 2015 13:31:52 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> 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 Message-ID: <201509131331.t8DDVqcs069034@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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}}')"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509131331.t8DDVqcs069034>