reject overlong base64 vlq in source map parser - #503
Open
fr-manvi wants to merge 1 commit into
Open
Conversation
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.
An overlong Base64 VLQ shifts a 32-bit accumulator by 32 or more bits in ReadBase64VLQ:
shiftby 5 for every continuation digit with no cap, unlike the LEB128 readers in webassembly.cc and dwarf/dwarf_util.cc which stop at a max shiftmappingsstring with 8+ continuation digits reaches shift 35, sodigit << shifton the uint32 is an out-of-range left shift (UBSan:shift exponent 35 is too large for 32-bit type)--source-map, so a crafted.maptriggers it under the undefined-sanitizer fuzz configReject once shift hits 32; a valid 32-bit VLQ never gets there, so valid maps are unaffected. Added a regression test under tests/wasm.