Fixes: out of array access
Fixes: 
47899/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5706852010164224

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
---
 libavformat/mov.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index fa471c45ea..3f7b0e3ed1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7501,12 +7501,12 @@ static int mov_read_iloc(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
         return AVERROR_PATCHWELCOME;
     }
     item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
-    if (item_count > 1) {
+    if (item_count != 1) {
         // For still AVIF images, we only support one item. Second item will
         // generally be found for AVIF images with alpha channel. We don't
         // support them as of now.
-        av_log(c->fc, AV_LOG_ERROR, "iloc: item_count > 1 not supported.\n");
-        return AVERROR_PATCHWELCOME;
+        av_log(c->fc, AV_LOG_ERROR, "iloc: item_count != 1 not supported.\n");
+        return item_count ? AVERROR_PATCHWELCOME : AVERROR_INVALIDDATA;
     }
 
     // Populate the necessary fields used by mov_build_index.
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to