Round-trip parsing and output generation causes difference in parsed result
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by running the Rust reproducer from the issue and compare the two token lists for the shown input. Trace the token parsing and ToCss serialization paths involved; the fix is complete when parsing the generated string preserves the original parsed result and the regression is covered by a test.
Written by the indexing model from the issue text.
Description
Found this while fuzzing.
extern crate cssparser;
use cssparser::ToCss;
fn main() {
let input = "\\\n3:\'\\\x0c";
println!("input:\n\t{:?}", input);
let mut parser_input = cssparser::ParserInput::new(input);
let mut parser = cssparser::Parser::new(&mut parser_input);
let tokens = parser
.next_including_whitespace_and_comments()
.into_iter()
.collect::<Vec<_>>();
println!("tokens:\n\t{:?}", tokens);
let str2 = tokens.iter().map(|t| t.to_css_string()).collect::<String>();
println!("tokens to string:\n\t{:?}", str2);
let mut parser_input = cssparser::ParserInput::new(&str2);
let mut parser = cssparser::Parser::new(&mut parser_input);
let tokens2 = parser
.next_including_whitespace_and_comments()
.into_iter()
.collect::<Vec<_>>();
println!("tokens to string to tokens:\n\t{:?}", tokens2);
}
input:
"\\\n3:\'\\\u{c}"
tokens:
[Delim('\\')]
tokens to string:
"\\"
tokens to string to tokens:
[Ident("�")]
- Dominant language
- Rust
- Stars
- 869
- Forks
- 152
- Avg merge
- 15h 8m
- Merged PRs (30d)
- 12
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from servo/rust-cssparser
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
servo/rust-cssparser#440 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
servo/rust-cssparser#439 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
servo/rust-cssparser#434 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
servo/rust-cssparser#438 · 3 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
servo/rust-cssparser#436 · 1 comment ·
All issues in servo/rust-cssparser
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
stratum-mining/stratum#2404 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug team:backend track:services-maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cowprotocol/services#4950 ·