-
Notifications
You must be signed in to change notification settings - Fork 269
Dtd handling correction for issue #923 #925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #925 +/- ##
==========================================
+ Coverage 58.08% 58.28% +0.20%
==========================================
Files 42 42
Lines 15513 15749 +236
==========================================
+ Hits 9011 9180 +169
- Misses 6502 6569 +67
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see DTD code parsing in the separate file (src/reader/dtd.rs). So move DTDParseState to dtd.rs and
impl DTDParseState {
fn feed(&mut self, chunk: &[u8]) {
...
}
}Also, it seems that this code crashed on some inputs, see the fuzzing results.
| Comment, | ||
| /// <!DOCTYPE...>. Contains balance of '<' (+1) and '>' (-1) | ||
| DocType(i32), | ||
| DocType { state: DTDParseState }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that named parameter is useless
| DocType { state: DTDParseState }, | |
| DocType(DTDParseState), |
| r#"<!ELEMENT e ANY><!ATTLIST a><!ENTITY ent '>'><!NOTATION n SYSTEM '>'><?pi >?><!-->-->"#, // in issue #258 | ||
| ]; | ||
|
|
||
| for int_subset in INT_SUBSETS { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to have separate test for each subset instead of a loop. So much easier to track where something break.
Hello, I have implemented the fix for issue #923 and would like to merge it into the master branch.
The PR primarily consists of fixes to
reader::BangType::DocTypeandreader::BangType::parse, along with the addition of a small test totests/issues.rs.I believe these fixes will at least enable correct skipping of well-formed DTDs.
While adding checks for ill-formed DTDs might not be impossible, the current implementation lacks a mechanism for
reader::BangType::parseto report errors. Since this would require significant changes, this update focuses solely on skipping well-formed DTD internal subsets without errors.Thank you for your confirmation.