Treat reaching the maximum parse depth as EOF#3121
Merged
flavorjones merged 1 commit intoFeb 4, 2024
Conversation
The parser is fragile and hitting the maximum tree depth has exposed several bugs. By treating this condition as if it is an EOF means that we're back in the normal parsing condition. This does expose a weakness in Gumbo's design: A spec bug that results in skipped steps or failure to reprocess a token (or if we fail to implement the spec in such a way), then the result can be crashes. Not ideal. Fixes: oss-fuzz-66107
Member
|
@stevecheckoway Thank you! No sweat on the testing; I feel like things the fuzzer finds aren't always great to add to a functional test suite, anyway. I manually tested this branch against the fuzzer repro and it looks great! ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The parser is fragile and hitting the maximum tree depth has exposed several bugs. By treating this condition as if it is an EOF means that we're back in the normal parsing condition.
This does expose a weakness in Gumbo's design: A spec bug that results in skipped steps or failure to reprocess a token (or if we fail to implement the spec in such a way), then the result can be crashes. Not ideal.
Fixes: oss-fuzz-66107
What problem is this PR intended to solve?
oss-fuzz-66107
Have you included adequate test coverage?
Nope! I'm sorry to punt on testing again but I didn't take the time to understand why this bug occurred so I didn't produce a minimal test case. Treating hitting the max depth as EOF just seemed like the best way to fix this whole class of bugs by turning the exceptional (> max depth) parsing case into the normal parsing case.
Does this change affect the behavior of either the C or the Java implementations?
C