diff mbox series

[FFmpeg-devel,6/6] avformat/argo_brp: Check that ASF chunk header is completely read

Message ID 20240820075057.1735944-6-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/6] avcodec/magicyuvenc: better slice height | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Aug. 20, 2024, 7:50 a.m. UTC
Fixes: Use of uninitialized value
Fixes: 71280/clusterfuzz-testcase-minimized-ffmpeg_dem_ARGO_BRP_fuzzer-4692991866896384

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

Patch

diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index f88def37313..94b404b5d06 100644
--- a/libavformat/argo_brp.c
+++ b/libavformat/argo_brp.c
@@ -380,8 +380,8 @@  static int argo_brp_read_packet(AVFormatContext *s, AVPacket *pkt)
         if (blk.size < ASF_CHUNK_HEADER_SIZE)
             return AVERROR_INVALIDDATA;
 
-        if ((ret = avio_read(s->pb, buf, ASF_CHUNK_HEADER_SIZE)) < 0)
-            return ret;
+        if (avio_read(s->pb, buf, ASF_CHUNK_HEADER_SIZE) != ASF_CHUNK_HEADER_SIZE)
+            return AVERROR_INVALIDDATA;
 
         ff_argo_asf_parse_chunk_header(&ckhdr, buf);