aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-05-30 16:18:48 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-20 04:43:40 +0200
commitc7ef69c23c01aa23f557d41ebc307554a5432c41 (patch)
treeea4b63ae4ac4a09daf60cf7582e921b8b0b14247
parent274121179f4050a6c5f6db365d5103eed615613a (diff)
downloadffmpeg-c7ef69c23c01aa23f557d41ebc307554a5432c41.tar.gz
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.c9
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);