diff options
author | Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> | 2015-05-06 00:51:48 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-10 03:13:11 +0300 |
commit | 994538281645e1f12a0e238b5b7225566e51a98c (patch) | |
tree | 9a098b4a813f07056f3130cfb8aa100641dae424 | |
parent | ebc768cfa1c928ca38580e17bbf8f1b164731eb6 (diff) |
diracdec: check if reference could not be allocated
s->ref_pics[i] is later used as ref argument of interpolate_refplane,
where it is dereferenced.
If it is NULL, it causes a segmentation fault.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d93181ef3eacdb862d93448f31c97765a523d1db)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/diracdec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index f74a903b3c..cf1a5c7d9d 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1701,6 +1701,12 @@ static int dirac_decode_picture_header(DiracContext *s) ff_get_buffer(s->avctx, &s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF); break; } + + if (!s->ref_pics[i]) { + av_log(s->avctx, AV_LOG_ERROR, "Reference could not be allocated\n"); + return -1; + } + } /* retire the reference frames that are not used anymore */ |