HTMLRewriter: fix quadratic selector-VM stack scans on hostile nesting - #35930
Open
robobun wants to merge 2 commits into
Open
HTMLRewriter: fix quadratic selector-VM stack scans on hostile nesting#35930robobun wants to merge 2 commits into
robobun wants to merge 2 commits into
Claude / Claude Code Review
completed
Jul 26, 2026 in 19m 14s
Code review found 1 important issue
Found 1 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 1 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | patches/lolhtml/selectors-vm-quadratic.patch:148-156 |
open_name_counts HashMap breaks case-insensitive end-tag matching for Bytes-variant LocalName |
Annotations
Check failure on line 156 in patches/lolhtml/selectors-vm-quadratic.patch
claude / Claude Code Review
open_name_counts HashMap breaks case-insensitive end-tag matching for Bytes-variant LocalName
The new `open_name_counts.contains_key(&local_name)` guard uses `LocalName` as a HashMap key, but `LocalName` violates the Hash/Eq contract: it `#[derive(Hash)]`s (case-sensitive raw bytes for the `Bytes` variant) while its manual `PartialEq` does `eq_ignore_ascii_case`. Any tag that falls back to `LocalName::Bytes` — every hyphenated custom element, names >12 chars, names containing 0/7/8/9 — with a case difference between start and end tag (e.g. `<My-Widget>x</my-widget>`) now hashes to a diff
Loading