aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-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