Skip to content

Commit 7459593

Browse files
committed
Reduce max hash in raw strings to 255
1 parent 36525a7 commit 7459593

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/parse.rs

+4
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ fn raw_string(input: Cursor) -> Result<Cursor, Reject> {
472472
_ => return Err(Reject),
473473
}
474474
}
475+
if n > 255 {
476+
// https://github.com/rust-lang/rust/pull/95251
477+
return Err(Reject);
478+
}
475479
while let Some((i, ch)) = chars.next() {
476480
match ch {
477481
'"' if input.rest[i + 1..].starts_with(&input.rest[..n]) => {

tests/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn literal_raw_string() {
133133
// https://github.com/rust-lang/rust/pull/95251
134134
raw_string_literal_with_hashes(256)
135135
.parse::<TokenStream>()
136-
.unwrap();
136+
.unwrap_err();
137137
}
138138

139139
#[test]

0 commit comments

Comments
 (0)