binkaudio: prevent extradata overread
authorPaul B Mahol <onemda@gmail.com>
Sat, 9 Jun 2012 10:30:31 +0000 (10:30 +0000)
committerPaul B Mahol <onemda@gmail.com>
Sat, 9 Jun 2012 10:43:20 +0000 (10:43 +0000)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/binkaudio.c

index ee66b8b..591c6ab 100644 (file)
@@ -96,7 +96,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-    s->version_b = avctx->extradata && avctx->extradata[3] == 'b';
+    s->version_b = avctx->extradata_size >= 4 && avctx->extradata[3] == 'b';
 
     if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) {
         // audio is already interleaved for the RDFT format variant