diff mbox series

[FFmpeg-devel,1/2] avformat/mov: Check for EOF in mov_read_iloc()

Message ID 20220719233419.17185-1-michael@niedermayer.cc
State Accepted
Commit 744ad45c44e69e354e924902c4daf0044dcd9955
Headers show
Series [FFmpeg-devel,1/2] avformat/mov: Check for EOF in mov_read_iloc() | 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 July 19, 2022, 11:34 p.m. UTC
Fixes: Timeout
Fixes: 49216/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6563000529584128

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

Comments

Michael Niedermayer July 21, 2022, 5:35 p.m. UTC | #1
On Wed, Jul 20, 2022 at 01:34:18AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 49216/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6563000529584128
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 14550e6456..a09a762d91 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7555,6 +7555,8 @@  static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     for (int i = 0; i < item_count; i++) {
         int item_id = (version < 2) ? avio_rb16(pb) : avio_rb32(pb);
+        if (avio_feof(pb))
+            return AVERROR_INVALIDDATA;
         if (version > 0)
             avio_rb16(pb);  // construction_method.
         avio_rb16(pb);  // data_reference_index.