[FFmpeg-cvslog] avformat/wavdec: Check if there are 16 bytes before testing them

Michael Niedermayer git at videolan.org
Sun Jan 5 01:29:13 EET 2025


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Sat Aug  3 19:45:15 2024 +0200| [818e10d0ce0c72462eca0d2468c03787b3910228] | committer: Michael Niedermayer

avformat/wavdec: Check if there are 16 bytes before testing them

Fixes: use-of-uninitialized-value
Fixes: 70839/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5212907590189056

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 79a1cf30d1289f90da682263ba160f6e4a5a7bf1)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=818e10d0ce0c72462eca0d2468c03787b3910228
---

 libavformat/wavdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index d68ad25c2a..3cedb9a32a 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -691,8 +691,7 @@ static int w64_read_header(AVFormatContext *s)
     uint8_t guid[16];
     int ret;
 
-    avio_read(pb, guid, 16);
-    if (memcmp(guid, ff_w64_guid_riff, 16))
+    if (avio_read(pb, guid, 16) != 16 || memcmp(guid, ff_w64_guid_riff, 16))
         return AVERROR_INVALIDDATA;
 
     /* riff + wave + fmt + sizes */



More information about the ffmpeg-cvslog mailing list