diff options
author | Eric Huss <eric@huss.org> | 2018-07-10 18:13:06 -0700 |
---|---|---|
committer | Eric Huss <eric@huss.org> | 2018-07-10 18:13:06 -0700 |
commit | c67263f359b29cb23c9bf0b1a33fcdcc50fd129d (patch) | |
tree | 849124f014fc3cde39d060e8342a09da2b2e8550 | |
parent | 2be7ce9079fa02d9dd42958410ba1c40cef9811c (diff) | |
download | milf-rs-c67263f359b29cb23c9bf0b1a33fcdcc50fd129d.tar.gz milf-rs-c67263f359b29cb23c9bf0b1a33fcdcc50fd129d.zip |
0.5: Reject 0x7f (DEL) in strings.
cc #224
-rw-r--r-- | src/tokens.rs | 4 | ||||
-rw-r--r-- | test-suite/tests/invalid-misc.rs | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/tokens.rs b/src/tokens.rs index 1b5a755..79aeb60 100644 --- a/src/tokens.rs +++ b/src/tokens.rs @@ -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(()) } diff --git a/test-suite/tests/invalid-misc.rs b/test-suite/tests/invalid-misc.rs index bb70b97..7d34651 100644 --- a/test-suite/tests/invalid-misc.rs +++ b/test-suite/tests/invalid-misc.rs @@ -14,4 +14,6 @@ fn bad() { bad("a = -inf"); bad("a = inf"); bad("a = 9e99999"); + bad("a = \"\u{7f}\""); + bad("a = '\u{7f}'"); } |