-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix index out of bound issue when parsing mp4 segment #3403
Fix index out of bound issue when parsing mp4 segment #3403
Conversation
Thank you for contributing! |
lib/util/mp4_parser.js
Outdated
@@ -111,6 +111,12 @@ shaka.util.Mp4Parser = class { | |||
parseNext(absStart, reader, partialOkay, stopOnPartial) { | |||
const start = reader.getPosition(); | |||
|
|||
// size(4 bytes) + type(4 bytes) = 8 bytes | |||
if (stopOnPartial && start + 8 >= reader.getLength()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think == should be fine, right? If a box had only the required size & name fields, start + 8 == reader.getLength()
should be acceptable. Do you agree? Should this become >
instead of >=
?
Also, it looks like a similar check is needed below, when we handle FULL_BOX
types and read versionAndFlags
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree start + 8 == reader.getLength()
should be acceptable.
…rom DataViewReader
All tests passed! |
Description
Fixes #3402
Screenshots (optional)
Type of change
not work as expected)
Checklist:
./build/all.py
and the build passes./build/test.py
and all tests pass