diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-01-10 17:25:05 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-10 17:28:22 +0100 |
commit | a4d3cf10b2ece441ae25849a66b1c11d838f9381 (patch) | |
tree | 5f4df8a894cf44622ceecc6334ad3ac5f8962768 /libavcodec | |
parent | 0b52bdfb3b4702079d3e6cacaf54e38fe5bb7b6f (diff) | |
download | ffmpeg-a4d3cf10b2ece441ae25849a66b1c11d838f9381.tar.gz |
avcodec/diracdec: Check slices malloc and propagate error code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/diracdec.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index aa8e2b0db9..05e954bd63 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -772,7 +772,7 @@ static int decode_lowdelay_slice(AVCodecContext *avctx, void *arg) * Dirac Specification -> * 13.5.1 low_delay_transform_data() */ -static void decode_lowdelay(DiracContext *s) +static int decode_lowdelay(DiracContext *s) { AVCodecContext *avctx = s->avctx; int slice_x, slice_y, bytes, bufsize; @@ -781,6 +781,8 @@ static void decode_lowdelay(DiracContext *s) int slice_num = 0; slices = av_mallocz_array(s->lowdelay.num_x, s->lowdelay.num_y * sizeof(struct lowdelay_slice)); + if (!slices) + return AVERROR(ENOMEM); align_get_bits(&s->gb); /*[DIRAC_STD] 13.5.2 Slices. slice(sx,sy) */ @@ -808,6 +810,7 @@ static void decode_lowdelay(DiracContext *s) intra_dc_prediction(&s->plane[1].band[0][0]); /* [DIRAC_STD] 13.3 intra_dc_prediction() */ intra_dc_prediction(&s->plane[2].band[0][0]); /* [DIRAC_STD] 13.3 intra_dc_prediction() */ av_free(slices); + return 0; } static void init_planes(DiracContext *s) @@ -1590,6 +1593,7 @@ static int dirac_decode_frame_internal(DiracContext *s) { DWTContext d; int y, i, comp, dsty; + int ret; if (s->low_delay) { /* [DIRAC_STD] 13.5.1 low_delay_transform_data() */ @@ -1597,8 +1601,10 @@ static int dirac_decode_frame_internal(DiracContext *s) Plane *p = &s->plane[comp]; memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); } - if (!s->zero_res) - decode_lowdelay(s); + if (!s->zero_res) { + if ((ret = decode_lowdelay(s)) < 0) + return ret; + } } for (comp = 0; comp < 3; comp++) { |