diff mbox series

[FFmpeg-devel,2/6] avformat/apetag: Check APETAGEX

Message ID 20240820075057.1735944-2-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: 71074/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5697034877730816

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

Patch

diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index bd0a19e4d6a..0989fcb0940 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -121,7 +121,8 @@  int64_t ff_ape_parse_tag(AVFormatContext *s)
 
     avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
 
-    avio_read(pb, buf, 8);     /* APETAGEX */
+    if(avio_read(pb, buf, 8) != 8)     /* APETAGEX */
+        return 0;
     if (strncmp(buf, APE_TAG_PREAMBLE, 8)) {
         return 0;
     }