1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00

diracdec: clear slice_params_num_buf on allocation failure

Otherwise it can be non-zero next time decode_lowdelay is called, causing
slice_params_buf not to be allocated, leading to a NULL pointer dereference.

The problem was introduced in commit
dcad4677d637cd2f701917e38361fa96b8c9a418.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2016-11-04 19:00:01 +01:00
parent 8a4ea96448
commit 24d20496d2

View File

@ -910,6 +910,7 @@ static int decode_lowdelay(DiracContext *s)
s->slice_params_buf = av_realloc_f(s->slice_params_buf, s->num_x * s->num_y, sizeof(DiracSlice)); s->slice_params_buf = av_realloc_f(s->slice_params_buf, s->num_x * s->num_y, sizeof(DiracSlice));
if (!s->slice_params_buf) { if (!s->slice_params_buf) {
av_log(s->avctx, AV_LOG_ERROR, "slice params buffer allocation failure\n"); av_log(s->avctx, AV_LOG_ERROR, "slice params buffer allocation failure\n");
s->slice_params_num_buf = 0;
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
s->slice_params_num_buf = s->num_x * s->num_y; s->slice_params_num_buf = s->num_x * s->num_y;