0.5: Reject 0x7f (DEL) in strings.

cc #224
This commit is contained in:
Eric Huss 2018-07-10 18:13:06 -07:00
parent 04c1fe9df6
commit 86d9dd21d8
2 changed files with 4 additions and 2 deletions

View file

@ -331,7 +331,7 @@ impl<'a> Tokenizer<'a> {
fn literal_string(&mut self, start: usize) -> Result<Token<'a>, Error> {
self.read_string('\'', start, &mut |_me, val, _multi, i, ch| {
if ch == '\u{09}' || ('\u{20}' <= ch && ch <= '\u{10ffff}') {
if ch == '\u{09}' || ('\u{20}' <= ch && ch <= '\u{10ffff}' && ch != '\u{7f}') {
val.push(ch);
Ok(())
} else {
@ -373,7 +373,7 @@ impl<'a> Tokenizer<'a> {
}
Ok(())
}
ch if '\u{20}' <= ch && ch <= '\u{10ffff}' => {
ch if '\u{20}' <= ch && ch <= '\u{10ffff}' && ch != '\u{7f}' => {
val.push(ch);
Ok(())
}

View file

@ -14,4 +14,6 @@ fn bad() {
bad("a = -inf");
bad("a = inf");
bad("a = 9e99999");
bad("a = \"\u{7f}\"");
bad("a = '\u{7f}'");
}