mirror of https://git.ffmpeg.org/ffmpeg.git
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>
(cherry picked from commit b91e3c4c90
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
d92ef4f846
commit
3d742d20ab
|
@ -708,7 +708,11 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx,
|
||||||
|
|
||||||
start = bytestream2_tell(&gbc);
|
start = bytestream2_tell(&gbc);
|
||||||
for(i = 0; i < num_nalus; i++) {
|
for(i = 0; i < num_nalus; i++) {
|
||||||
|
if (bytestream2_get_bytes_left(&gbc) < 2)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
size = bytestream2_get_be16(&gbc);
|
size = bytestream2_get_be16(&gbc);
|
||||||
|
if (bytestream2_get_bytes_left(&gbc) < size)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
bytestream2_skip(&gbc, size);
|
bytestream2_skip(&gbc, size);
|
||||||
}
|
}
|
||||||
end = bytestream2_tell(&gbc);
|
end = bytestream2_tell(&gbc);
|
||||||
|
|
Loading…
Reference in New Issue