[FFmpeg-cvslog] libopenjpegdec: always check image because decoding may still fail

Paul B Mahol git at videolan.org
Mon Mar 26 05:45:01 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Mar 26 02:01:23 2012 +0000| [02fb320adadacfc8446a1278582351078a024dee] | committer: Michael Niedermayer

libopenjpegdec: always check image because decoding may still fail

Fixes bunch of segfaults.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=02fb320adadacfc8446a1278582351078a024dee
---

 libavcodec/libopenjpegdec.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 29724a2..fced76d 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -295,6 +295,11 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
     // Decode the codestream
     image = opj_decode_with_info(dec, stream, NULL);
     opj_cio_close(stream);
+    if(!image) {
+        av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
+        opj_destroy_decompress(dec);
+        return -1;
+    }
 
     pixel_size = av_pix_fmt_descriptors[avctx->pix_fmt].comp[0].step_minus1 + 1;
     ispacked = libopenjpeg_ispacked(avctx->pix_fmt);



More information about the ffmpeg-cvslog mailing list