aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-08-03 19:45:15 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-08-05 23:17:45 +0200
commit79a1cf30d1289f90da682263ba160f6e4a5a7bf1 (patch)
tree468d39f7801b8850d471b40d9267f074c75c8793
parente0f9f4d49153df3a0a43f27bb7ffa3ae3a892237 (diff)
downloadffmpeg-79a1cf30d1289f90da682263ba160f6e4a5a7bf1.tar.gz
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@niedermayer.cc>
-rw-r--r--libavformat/wavdec.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 00856a5eca..78e37b88d7 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -874,8 +874,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 */