avformat/vqf: Ensure that comm_chunk is fully read
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 23 Jul 2025 11:36:42 +0000 (13:36 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 4 Aug 2025 14:44:24 +0000 (16:44 +0200)
Fixes: use of uninitialized memory
Fixes: 412125811/clusterfuzz-testcase-minimized-ffmpeg_dem_VQF_fuzzer-6253774274887680

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1b7a327b3a43df6ab82885cea5ae02bf9dd899a9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/vqf.c

index db49fdcfd9790b89e304b5981d8fdaa1e7ee64fe..e282011845ab08b7cc275c19cc09a459b5724970 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "avio_internal.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
@@ -141,7 +142,9 @@ static int vqf_read_header(AVFormatContext *s)
             if (len < 12)
                 return AVERROR_INVALIDDATA;
 
-            avio_read(s->pb, comm_chunk, 12);
+            ret = ffio_read_size(s->pb, comm_chunk, 12);
+            if (ret < 0)
+                return ret;
             st->codecpar->ch_layout.nb_channels = AV_RB32(comm_chunk) + 1;
             read_bitrate        = AV_RB32(comm_chunk + 4);
             rate_flag           = AV_RB32(comm_chunk + 8);