diff mbox series

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

Message ID 20211204213258.11971-1-michael@niedermayer.cc
State Accepted
Commit 59b4e7cbd87889c0bac710ac7f62782b637419a1
Headers show
Series [FFmpeg-devel,1/4] avformat/mov: Check for EOF in mov_read_glbl() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Dec. 4, 2021, 9:32 p.m. UTC
Fixes: Infinite loop
Fixes: 41351/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5433895854669824

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(+)
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e34453432d3..ff5a55d0e62 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1930,6 +1930,8 @@  static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         // wrap a whole fiel atom inside of a glbl atom.
         unsigned size = avio_rb32(pb);
         unsigned type = avio_rl32(pb);
+        if (avio_feof(pb))
+            return AVERROR_INVALIDDATA;
         avio_seek(pb, -8, SEEK_CUR);
         if (type == MKTAG('f','i','e','l') && size == atom.size)
             return mov_read_default(c, pb, atom);