avcodec/mvha: fix warning: variable 'size' set but not used
authorLimin Wang <lance.lmwang@gmail.com>
Fri, 27 Dec 2019 15:58:35 +0000 (23:58 +0800)
committerJames Almer <jamrial@gmail.com>
Fri, 27 Dec 2019 16:13:39 +0000 (13:13 -0300)
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/mvha.c

index c270063..afe5e51 100644 (file)
@@ -161,6 +161,9 @@ static int decode_frame(AVCodecContext *avctx,
     type = AV_RB32(avpkt->data);
     size = AV_RL32(avpkt->data + 4);
 
+    if (size < 1 || size >= avpkt->size)
+        return AVERROR_INVALIDDATA;
+
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
         return ret;