diff --git a/libavformat/mov.c b/libavformat/mov.c index f2a66b8a95be9eb182d39d02dda98173bd4551f7..a157d603309ded599fb5ce50155b121e043627d5 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; }