diff mbox series

[FFmpeg-devel,2/6] avformat/av1dec: Check bits left before get_leb128()

Message ID 20240806221853.959177-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/6] avformat/segafilm: Set keyframe | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Michael Niedermayer Aug. 6, 2024, 10:18 p.m. UTC
Fixes: use of uninitialized value
Fixes: 70872/clusterfuzz-testcase-minimized-ffmpeg_dem_OBU_fuzzer-6005782487826432

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/av1dec.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index 3363003b181..a5b620a0abf 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -326,6 +326,9 @@  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;