Skip to content

fix: bounds-check GENERATED_RANGE_SUBRANGE_BINDING variable indices - #24

Merged
szuend merged 1 commit into
mainfrom
fix/subrange-binding-bounds-check
Oct 13, 2026
Merged

szuend merged 1 commit into
mainfrom
fix/subrange-binding-bounds-check

Conversation

@szuend

@szuend szuend commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

The variable index of a GENERATED_RANGE_SUBRANGE_BINDING item was used as an index into range.values without validation. A huge index (e.g. "H//////B" = 2^31 - 1) turned values into a sparse array of that length, and the subsequent for-of loop iterated every hole, effectively hanging the decoder on a tiny malicious source map.

Sub-range bindings can only refine an existing binding from the GENERATED_RANGE_BINDINGS item, so out-of-bounds (or negative, due to VLQ overflow) indices are now ignored in lax mode and throw in strict mode.

The variable index of a GENERATED_RANGE_SUBRANGE_BINDING item was used
as an index into `range.values` without validation. A huge index (e.g.
"H//////B" = 2^31 - 1) turned `values` into a sparse array of that length,
and the subsequent for-of loop iterated every hole, effectively hanging
the decoder on a tiny malicious source map.

Sub-range bindings can only refine an existing binding from the
GENERATED_RANGE_BINDINGS item, so out-of-bounds (or negative, due to VLQ
overflow) indices are now ignored in lax mode and throw in strict mode.
@szuend
szuend requested a review from OrKoN October 13, 2026 07:08
@szuend
szuend merged commit 4837b2d into main Oct 13, 2026
7 checks passed
@szuend
szuend deleted the fix/subrange-binding-bounds-check branch October 13, 2026 07:12
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.

2 participants