Update getMatroskaUint to handle larger integer values #4136
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.
Currently,
EBMLParser.getMatroskaUint
will fail for values exceeding0x7FFFFFFF
due to JavaScript's bitwise operators converting numbers to 32-bit signed integers. This change should partially improve the handling of values whensize
is 5 or greater, up toNumber.MAX_SAFE_INTEGER
.Since JavaScript numbers using 64-bit floats under the hood, this function will still fail if the value would exceed
MAX_SAFE_INTEGER
. As such, an error is thrown in these cases. To resolve this,BigInt
or some counterpart would likely have to be used, which goes beyond the scope of what this PR is intending to change.From what I can tell, this should mostly resolve #3247, and should enable support for video sizes of up to 256TB, rather than 2GB.