diff --git a/libavformat/mov.c b/libavformat/mov.c index f2a66b8a95..a157d60330 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3471,7 +3471,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) } } total_size += 8; - if (a.size == 1) { /* 64 bit extended size */ + if (a.size == 1 && total_size + 8 <= atom.size) { /* 64 bit extended size */ a.size = avio_rb64(pb) - 8; total_size += 8; }