diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c index 9c4195342f..3faebb3aca 100644 --- a/libavcodec/movtextdec.c +++ b/libavcodec/movtextdec.c @@ -477,10 +477,6 @@ static int mov_text_decode_frame(AVCodecContext *avctx, tsmb_type = AV_RB32(tsmb); tsmb += 4; - if (tsmb_size == 0) { - return AVERROR_INVALIDDATA; - } - if (tsmb_size == 1) { if (m->tracksize + 16 > avpkt->size) break; @@ -491,6 +487,10 @@ static int mov_text_decode_frame(AVCodecContext *avctx, m->size_var = 8; //size_var is equal to 8 or 16 depending on the size of box + if (tsmb_size == 0) { + return AVERROR_INVALIDDATA; + } + if (tsmb_size > avpkt->size - m->tracksize) break;