aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-01 13:09:12 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-01 13:09:12 +0000
commitf2ab971cb0c08226e125c46f514c80e992f39500 (patch)
treed83f5825637e8b9e7d499a7d452ab1f621e9332b /crates/ra_syntax
parent5a866a772c863ba7e3ec8bad353c1b6997a7a62a (diff)
parent0ddeb3b824dcabc2b3a99feb0be036782fa56fee (diff)
Merge #398
398: Fix the same bug as #396 but for bytes too r=matklad a=DJMcNab #396 Co-authored-by: DJMcNab <[email protected]>
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/validation/byte.rs4
-rw-r--r--crates/ra_syntax/tests/data/parser/fuzz-failures/0004.rs1
2 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/validation/byte.rs b/crates/ra_syntax/src/validation/byte.rs
index d0897eeed..714224b09 100644
--- a/crates/ra_syntax/src/validation/byte.rs
+++ b/crates/ra_syntax/src/validation/byte.rs
@@ -88,7 +88,9 @@ fn validate_byte_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxErr
88 88
89fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxError>) { 89fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxError>) {
90 // A ByteCodeEscape has 4 chars, example: `\xDD` 90 // A ByteCodeEscape has 4 chars, example: `\xDD`
91 if text.len() < 4 { 91 if !text.is_ascii() {
92 errors.push(SyntaxError::new(MalformedByteCodeEscape, range));
93 } else if text.chars().count() < 4 {
92 errors.push(SyntaxError::new(TooShortByteCodeEscape, range)); 94 errors.push(SyntaxError::new(TooShortByteCodeEscape, range));
93 } else { 95 } else {
94 assert!( 96 assert!(
diff --git a/crates/ra_syntax/tests/data/parser/fuzz-failures/0004.rs b/crates/ra_syntax/tests/data/parser/fuzz-failures/0004.rs
new file mode 100644
index 000000000..003290f52
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/fuzz-failures/0004.rs
@@ -0,0 +1 @@
b"\xʿ \ No newline at end of file