Skip to content

Conversation

@tayu0110
Copy link

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::DocType and reader::BangType::parse, along with the addition of a small test to tests/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::parse to 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.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 74.55357% with 57 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.28%. Comparing base (d1acdb5) to head (9664eff).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
src/reader/mod.rs 74.43% 57 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
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     
Flag Coverage Δ
unittests 58.28% <74.55%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@Mingun Mingun left a 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 },
Copy link
Collaborator

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

Suggested change
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 {
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants