diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-05-30 17:18:48 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-20 05:43:40 +0300 |
commit | c7ef69c23c01aa23f557d41ebc307554a5432c41 (patch) | |
tree | ea4b63ae4ac4a09daf60cf7582e921b8b0b14247 | |
parent | 274121179f4050a6c5f6db365d5103eed615613a (diff) |
libopenjpegdec: check existence of image component data
libopenjpeg can return images with components without data.
This fixes segmentation faults.
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 3ef5702926c495232ffe685303ba8661bdff1149)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/libopenjpegdec.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 1cd1b9b009..ab681f1246 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -358,6 +358,15 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, goto done; } + for (i = 0; i < image->numcomps; i++) { + if (!image->comps[i].data) { + av_log(avctx, AV_LOG_ERROR, + "Image component %d contains no data.\n", i); + ret = AVERROR_INVALIDDATA; + goto done; + } + } + desc = av_pix_fmt_desc_get(avctx->pix_fmt); pixel_size = desc->comp[0].step_minus1 + 1; ispacked = libopenjpeg_ispacked(avctx->pix_fmt); |