Skip to content

Commit dffd53c

Browse files
committed
Reduce max hash in raw strings to 255
1 parent f0a3490 commit dffd53c

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
@@ -137,7 +137,7 @@ fn literal_raw_string() {
137137
// https://github.com/rust-lang/rust/pull/95251
138138
raw_string_literal_with_hashes(256)
139139
.parse::<TokenStream>()
140-
.unwrap();
140+
.unwrap_err();
141141
}
142142

143143
#[test]

0 commit comments

Comments
 (0)