Repository navigation
fix(html): make deeply nested input linear and stop nested-table row duplication - #43
Merged
Merged
Conversation
Measures per-case latency, ops/s, throughput and heap allocations (count, bytes, peak) plus process peak RSS over a generated HTML/DOCX/XLSX/ODS corpus. just bench saves JSON + Markdown reports to crates/markkit-bench/results/, mirroring bashkit-bench. Criterion moves to just bench-criterion.
…duplication html5ever's tree builder is quadratic in nesting depth: 687 KiB of nested divs took 12.6 s and 292 KiB of unclosed nested tables ran past the 60 s timeout. A pre-scan (html::nesting::cap_nesting) now drops tags nested past max_nesting_depth + 8 before html5ever runs, keeping text. Tables took rows via descendant queries, copying nested-table rows into every enclosing table (4x output per level). Rows now come from direct structure only. Text flattened at max_nesting_depth leaked script/style/template bodies; flat_text skips non-content elements. New invariant S17.
# Conflicts: # knowledge/security/threat-model.md
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.
Requested by Михайло · project thread
What changed
max_nesting_depth + 8before html5ever sees the input; tags past the cap are dropped, text is kept. Non-content subtrees (script, style, template, form, ...) past the cap are dropped whole, and so are hidden elements (T9 rules on raw attributes) unlessinclude_hidden_content(true).thead/tbody/tr), not descendant selection.max_nesting_depthno longer leak<script>/<style>/<template>bodies or hidden content into output (pre-existing gaps, found while fixing).Why
markkit-bench(#22) showedhtml_deep_nestingas the outlier. html5ever's tree builder is O(depth) per start tag, so nesting cost is quadratic: a few MB of<div>is a CPU DoS, and nested tables grew output 4x per level.Before / After
Release build:
<div><table><tr><td><ul><li>html_deep_nestingOther HTML bench cases: allocation counts unchanged.
Risk
max_nesting_depth(already flattened before) and for nested tables (previously duplicated rows).>, raw text, foreign content, optional end tags, hidden attributes, malformed tails.Checklist
html_security::deep_*,nested_table_rows_are_not_duplicated,script_and_style_bodies_do_not_leak_past_max_depth,hidden_content_does_not_leak_past_max_depth, nesting unit tests)🤖 Generated with Claude Code