Repository navigation
fix: crafted pages could crash the parser or make it crawl - #49
Merged
Merged
Conversation
Synced from Netweir 510e5a8 (netweir/netweir#238). Copying a selected option's contents into <selectedcontent> no longer recurses once per level of nesting, which overflowed the stack on about 100 KB of nested markup. Three walks of the open-element stack that ran once per tag now return at once when nothing can match. The README also shows the OpenSSF Best Practices badge, now that Parsec has passed, beside Scorecard and CI.
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.
Problem. Four inputs could hurt the parser. About 100 KB of nested markup inside a
<select>overflowed the stack and aborted the process. Three other patterns took seconds on a few hundred kilobytes, because a step walked the stack of open elements once per tag.Change.
510e5a8(fix(html): crafted pages could crash the parser or make it crawl netweir/netweir#238), where the fix and its tests were made.NETWEIR_COMMITmoves to that commit.Tests. The four new tests in
tree.rs'shostilemodule come with the sync. One parses on a 256 KB stack. The others fail if four times the input takes more than eight times as long. Before the fix, each of those took sixteen times as long.cargo testpasses, and the drift check is clean against510e5a8.