Skip to content

Commit

Permalink
Fix fuzzer-found skip-ident bug
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Sep 1, 2023
1 parent 39c0929 commit 1e8c29e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ impl<'a> Parser<'a> {

if let Some(c) = self.peek() {
// maybe a normal identifier
if is_xid_start(c) {
if is_ident_first_char(c) {
self.advance(
c.len_utf8() + self.next_chars_while_from(c.len_utf8(), is_xid_continue),
);
Expand Down
12 changes: 12 additions & 0 deletions tests/321_unicode_ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,15 @@ fn roundtrip_unicode_ident() {

assert_eq!(Ok(value), deserial);
}

#[test]
fn fuzzer_issues() {
assert_eq!(
ron::from_str::<ron::Value>("(__: ())").unwrap(),
ron::Value::Map(
[(ron::Value::String(String::from("__")), ron::Value::Unit)]
.into_iter()
.collect()
)
);
}

0 comments on commit 1e8c29e

Please sign in to comment.