avcodec/cbs_h2645: Check NAL space

Found-by-reviewing: CID1419833 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-04-22 03:23:10 +02:00
parent 02301017d2
commit b91e3c4c90
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 4 additions and 0 deletions

View File

@ -709,7 +709,11 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx,
start = bytestream2_tell(&gbc);
for(i = 0; i < num_nalus; i++) {
if (bytestream2_get_bytes_left(&gbc) < 2)
return AVERROR_INVALIDDATA;
size = bytestream2_get_be16(&gbc);
if (bytestream2_get_bytes_left(&gbc) < size)
return AVERROR_INVALIDDATA;
bytestream2_skip(&gbc, size);
}
end = bytestream2_tell(&gbc);