mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-28 18:32:22 +00:00
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>
This commit is contained in:
parent
161d0ac721
commit
3ef5702926
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user