Reject VCL OBUs with mlayer_id/tlayer_id > max - #5430
Merged
Merged
Conversation
In handle_sequence_header(), validate that a VCL OBU's mlayer_id and tlayer_id do not exceed the active sequence header's max_mlayer_id and max_tlayer_id before using the active sequence header on non-keyframes. Previously, those bounds were only checked when activating a new sequence header on a keyframe, causing an assertion failure in is_tlayer_scalable_and_dependent() when decoding a subsequent non-keyframe VCL OBU with an out-of-range mlayer_id.
y-guyon
commented
Sep 23, 2026
urvangjoshi
approved these changes
Sep 23, 2026
wantehchang
reviewed
Sep 24, 2026
| // much | ||
| cm->seq_params = pbi->active_seq[xlayer_id]; | ||
|
|
||
| if (!keyframe_unit_in_tu) { |
Member
There was a problem hiding this comment.
Yannis: This if statement becomes dead code after you added keyframe_unit_in_tu && to the condition at line 7629. Please double check whether this if statement should be deleted or should be moved to a different place, such as inside the new if statement at line 7860.
Note: I didn't really review this PR. I only did some pattern matching.
| } | ||
|
|
||
| if (!keyframe_unit_in_tu) { | ||
| return; |
Member
There was a problem hiding this comment.
See my comment at line 7644. I wonder if we should move the are_seq_headers_consistent() check here so that this if statement looks like the following:
if (!keyframe_unit_in_tu) {
if (!are_seq_headers_consistent(&cm->seq_params, seq_from_uch)) {
avm_internal_error(&cm->error, AVM_CODEC_CORRUPT_FRAME,
"Sequence Header changed at %s",
avm_obu_type_to_string(obu_type));
}
return;
}
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.
In handle_sequence_header(), validate that a VCL OBU's mlayer_id and tlayer_id do not exceed the active sequence header's max_mlayer_id and max_tlayer_id before using the active sequence header on non-keyframes. Previously, those bounds were only checked when activating a new sequence header on a keyframe, causing an assertion failure in is_tlayer_scalable_and_dependent() when decoding a subsequent non-keyframe VCL OBU with an out-of-range mlayer_id.
To reproduce:
build/test_libavm --gtest_filter="*InvalidMlayerIdInNonKeyframeObu*"Without the patch:
With the patch:
This bug was found with libavif's fuzz targets.