avcodec_decode_audio4: check got_frame_ptr before handling initial skip
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 21 Feb 2013 21:00:19 +0000 (22:00 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 21 Feb 2013 21:01:14 +0000 (22:01 +0100)
Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/utils.c

index 3d75407..313b45a 100644 (file)
@@ -1831,7 +1831,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
             av_log(avctx, AV_LOG_DEBUG, "skip %d samples due to side data\n",
                    avctx->internal->skip_samples);
         }
-        if (avctx->internal->skip_samples) {
+        if (avctx->internal->skip_samples && *got_frame_ptr) {
             if(frame->nb_samples <= avctx->internal->skip_samples){
                 *got_frame_ptr = 0;
                 avctx->internal->skip_samples -= frame->nb_samples;