You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 85e19ce
Browse filesBrowse the repository at this point in the historyBrowse files
Fix ReDoS in the SVG parser, clean up ESLint and SonarJS findings
ESLint (typescript-eslint strict type-checked) with SonarJS, knip and a
regex timing harness over every regular expression of src:
- svg.ts: regular expressions that backtracked on hostile input are
replaced: the stylesheet (blocks and comments) is scanned with
indexOf, url() references by a small scanner, numbers use a pattern
whose alternatives can't match the same digits twice, colors and
lengths are trimmed instead of matching spaces twice. A 200,000
character style without braces took 60 s, url(#a followed by spaces
was exponential; all of them take a few ms now (regression tests).
The 1952 sample SVGs render the same; an unclosed style rule at the
end applies now, like in browsers
- types: the TIFF tags, quantizer lookup and SVG arrays are typed
(no any), Shaper hooks are function properties (no unbound methods),
redundant assertions removed
- layout.ts: one coverage list helper for contexts and reverse
chaining; text.ts, buffer.ts, machine.ts: unused helpers removed
- one statement per line where single-line blocks read like bugs
(vp8.ts, hinting.ts), substr -> slice, prefer-const
The remaining findings are style (cognitive complexity, nested
ternaries, const enum comparisons) or defensive checks TypeScript
considers impossible (index lookups, input from JavaScript callers).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
0 commit comments