[FFmpeg-devel] [PATCH] avcodec/alsdec: properly allocate raw_buffer

Paul B Mahol onemda at gmail.com
Sat Jul 1 04:38:21 EEST 2017


This also reverts 18f94df8.

Fixes #5297.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/alsdec.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index d95e30d..4a8f13d 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -705,11 +705,6 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
         } else {
             *bd->opt_order = sconf->max_order;
         }
-        if (*bd->opt_order > bd->block_length) {
-            *bd->opt_order = bd->block_length;
-            av_log(avctx, AV_LOG_ERROR, "Predictor order too large.\n");
-            return AVERROR_INVALIDDATA;
-        }
         opt_order = *bd->opt_order;
 
         if (opt_order) {
@@ -2062,7 +2057,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     channel_size      = sconf->frame_length + sconf->max_order;
 
     ctx->prev_raw_samples = av_malloc_array(sconf->max_order, sizeof(*ctx->prev_raw_samples));
-    ctx->raw_buffer       = av_mallocz_array(avctx->channels * channel_size, sizeof(*ctx->raw_buffer));
+    ctx->raw_buffer       = av_mallocz_array(avctx->channels * channel_size + sconf->max_order, sizeof(*ctx->raw_buffer));
     ctx->raw_samples      = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples));
 
     if (sconf->floating) {
-- 
2.9.3



More information about the ffmpeg-devel mailing list