diff mbox series

[FFmpeg-devel,4/5] avformat/mvdec: Check if name was fully read

Message ID 20240814223714.2436993-4-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/5] MAINTAINERS: Add a maintaince level field | expand

Checks

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

Commit Message

Michael Niedermayer Aug. 14, 2024, 10:37 p.m. UTC
Fixes: use of uninitialized value
Fixes: 70901/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-6341913949569024

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

Patch

diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index 0718f0483a7..c045d2c7c8e 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -256,7 +256,8 @@  static int read_table(AVFormatContext *avctx, AVStream *st,
         if (avio_feof(pb))
             return AVERROR_EOF;
 
-        avio_read(pb, name, 16);
+        if (avio_read(pb, name, 16) != 16)
+            return AVERROR_INVALIDDATA;
         name[sizeof(name) - 1] = 0;
         size = avio_rb32(pb);
         if (size < 0) {