avformat/av1dec: Better fix for 70872/clusterfuzz-testcase-minimized-ffmpeg_dem_OBU_fuzzer-6005782487826432

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-08-03 18:35:48 +02:00
parent 45ee6b1e3d
commit 7ad937f0c8
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -326,9 +326,6 @@ static int read_obu_with_size(const uint8_t *buf, int buf_size, int64_t *obu_siz
skip_bits(&gb, 3); // extension_header_reserved_3bits
}
if (get_bits_left(&gb) < 8)
return AVERROR_INVALIDDATA;
*obu_size = get_leb128(&gb);
if (*obu_size > INT_MAX)
return AVERROR_INVALIDDATA;
@ -382,6 +379,7 @@ static int obu_get_packet(AVFormatContext *s, AVPacket *pkt)
if (size < 0)
return size;
memset(header + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
len = read_obu_with_size(header, size, &obu_size, &type);
if (len < 0) {
av_log(c, AV_LOG_ERROR, "Failed to read obu\n");