Fix a fuzzing bug and add Cargo.lock to the fuzzing directory
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -70,7 +70,7 @@ pub(super) fn validate_char_component(
|
||||
|
||||
fn validate_ascii_escape(text: &str, range: TextRange, errors: &mut Vec<SyntaxError>) {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user