]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/twinvq.c
x86: dsputil: Separate ff_add_hfyu_median_prediction_cmov from dsputil_mmx
[ffmpeg] / libavcodec / twinvq.c
index 17dea79ed75756035b21ba4cf7676f8bc5ecae3a..24f57478f808db45700b11ac95492bd4d875583c 100644 (file)
@@ -491,6 +491,12 @@ int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,
         out = (float **)frame->extended_data;
     }
 
+    if (buf_size < avctx->block_align) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Frame too small (%d bytes). Truncated file?\n", buf_size);
+        return AVERROR(EINVAL);
+    }
+
     if ((ret = tctx->read_bitstream(avctx, tctx, buf, buf_size)) < 0)
         return ret;
 
@@ -508,7 +514,7 @@ int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,
 
     *got_frame_ptr = 1;
 
-    return buf_size;
+    return avctx->block_align;
 }
 
 /**