Skip to content

fix: crafted pages could crash the parser or make it crawl - #49

Merged
jamesconwaydev merged 2 commits into
mainfrom
sync-hostile-fixes
Nov 4, 2026
Merged

jamesconwaydev merged 2 commits into
mainfrom
sync-hostile-fixes

Conversation

@jamesconwaydev

Copy link
Copy Markdown
Collaborator

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.

Tests. The four new tests in tree.rs's hostile module 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 test passes, and the drift check is clean against 510e5a8.

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.
@jamesconwaydev
jamesconwaydev enabled auto-merge (squash) November 4, 2026 18:53
@jamesconwaydev
jamesconwaydev merged commit 0fde84e into main Nov 4, 2026
16 of 17 checks passed
@jamesconwaydev
jamesconwaydev deleted the sync-hostile-fixes branch November 4, 2026 19:02
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.

1 participant