Commit 3ef57029 authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

libopenjpegdec: check existence of image component data

libopenjpeg can return images with components without data.

This fixes segmentation faults.
Reviewed-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 161d0ac7
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment