diff --git a/libavformat/mov.c b/libavformat/mov.c index e9b6c761f4..0ce63209dd 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -179,8 +179,10 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) break; } a.size -= 8; - if(a.size < 0 || a.size > atom.size - total_size) + if(a.size < 0) break; + if (a.size > atom.size - total_size) + a.size = atom.size - total_size; for (i = 0; c->parse_table[i].type != 0L && c->parse_table[i].type != a.type; i++)