diff --git a/libavformat/mov.c b/libavformat/mov.c index bfc5c44d87..16435e9fb2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3022,7 +3022,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; }