From 054f22f2312b60c8545386dadc712706323945b6 Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sat, 29 Dec 2018 12:40:08 +0000 Subject: Fix a fuzzing bug and add Cargo.lock to the fuzzing directory --- crates/ra_syntax/src/string_lexing/parser.rs | 2 +- crates/ra_syntax/src/validation/char.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/string_lexing/parser.rs b/crates/ra_syntax/src/string_lexing/parser.rs index 14c6015c2..e835382fc 100644 --- a/crates/ra_syntax/src/string_lexing/parser.rs +++ b/crates/ra_syntax/src/string_lexing/parser.rs @@ -82,7 +82,7 @@ impl<'a> Parser<'a> { fn parse_escape(&mut self, start: TextUnit) -> StringComponent { if self.peek().is_none() { - return StringComponent::new(TextRange::from_to(start, start), AsciiEscape); + return StringComponent::new(TextRange::from_to(start, self.get_pos()), AsciiEscape); } let next = self.advance(); diff --git a/crates/ra_syntax/src/validation/char.rs b/crates/ra_syntax/src/validation/char.rs index 19cd3830f..10d3d1dec 100644 --- a/crates/ra_syntax/src/validation/char.rs +++ b/crates/ra_syntax/src/validation/char.rs @@ -70,7 +70,7 @@ pub(super) fn validate_char_component( fn validate_ascii_escape(text: &str, range: TextRange, errors: &mut Vec) { if text.len() == 1 { - // Escape sequence consists only of leading `\` + // Escape sequence consists only of leading `\` (only occurs at EOF, otherwise e.g. '\' is treated as an unclosed char containing a single quote `'`) errors.push(SyntaxError::new(EmptyAsciiEscape, range)); } else { let escape_code = text.chars().skip(1).next().unwrap(); -- cgit v1.2.3