Skip to content
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(cea): make a more robust CEA MP4 parser #3965

Merged
merged 4 commits into from Feb 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/cea/mp4_cea_parser.js
Expand Up @@ -236,7 +236,13 @@ shaka.cea.Mp4CeaParser = class {
});
}
} else {
reader.skip(naluSize - 1);
try {
reader.skip(naluSize - 1);
} catch (e) {
if (e instanceof shaka.util.Error) {
break;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand the logic here. Some comments may be helpful.

If the error is a shaka.util.Error, you break out of the loop. If it's some other kind of error, you continue. I don't understand the purpose of either.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, although the function really only throws this error, it can be applied to everything.

}
sampleSize -= (naluSize + 4);
if (sampleSize == 0) {
Expand Down