sh: Don't create bad parse result when postponing a bad substitution error.
authorjilles <jilles@FreeBSD.org>
Sun, 23 Aug 2015 20:44:53 +0000 (20:44 +0000)
committerjilles <jilles@FreeBSD.org>
Sun, 23 Aug 2015 20:44:53 +0000 (20:44 +0000)
commitf504ca457f15fb7151537bd610d757a4d8163951
tree7649da2c39f43e98eb79a974979a3f8d15039d3a
parent9dba4c6890736d6ff29340b1a48dd5e2f99d8539
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.

MFC after: 1 week
bin/sh/parser.c
bin/sh/tests/errors/Makefile
bin/sh/tests/errors/bad-parm-exp7.0 [new file with mode: 0644]
bin/sh/tests/errors/bad-parm-exp8.0 [new file with mode: 0644]