diff --git a/src/parse.rs b/src/parse.rs index 307e0650..2a87948a 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -472,6 +472,10 @@ fn raw_string(input: Cursor) -> Result { _ => return Err(Reject), } } + if n > 255 { + // https://github.com/rust-lang/rust/pull/95251 + return Err(Reject); + } while let Some((i, ch)) = chars.next() { match ch { '"' if input.rest[i + 1..].starts_with(&input.rest[..n]) => { diff --git a/tests/test.rs b/tests/test.rs index 0033418e..e0af1512 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -137,7 +137,7 @@ fn literal_raw_string() { // https://github.com/rust-lang/rust/pull/95251 raw_string_literal_with_hashes(256) .parse::() - .unwrap(); + .unwrap_err(); } #[test]