adpcmdec: Fix OOM/infloop
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Nov 2012 18:17:23 +0000 (19:17 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Nov 2012 18:29:03 +0000 (19:29 +0100)
Found-by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/adpcm.c

index d8bbdbb..3249522 100644 (file)
@@ -1355,6 +1355,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
         return -1;
     }
 
+    if (avpkt->size && bytestream2_tell(&gb) == 0) {
+        av_log(avctx, AV_LOG_ERROR, "Nothing consumed\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     *got_frame_ptr   = 1;
     *(AVFrame *)data = c->frame;