diff --git a/libavformat/mov.c b/libavformat/mov.c index 1437d160f8..a80fcc1606 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7329,6 +7329,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (a.size == 0) { a.size = atom.size - total_size + 8; } + if (a.size < 0) + break; a.size -= 8; if (a.size < 0) break;