summaryrefslogtreecommitdiffstats
path: root/libavcodec/libopenjpegenc.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-06-01 00:51:30 +0200
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-06-02 22:40:58 +0200
commit1577526b47439f33a999339efdec5d624b70e1da (patch)
tree4fbf87887c4467e457e22571006d25d7a8e79199 /libavcodec/libopenjpegenc.c
parentb0af4043b90802ecf888a9bf0075c4d55cfb2d38 (diff)
downloadffmpeg-streaming-1577526b47439f33a999339efdec5d624b70e1da.zip
ffmpeg-streaming-1577526b47439f33a999339efdec5d624b70e1da.tar.gz
libopenjpegenc: add NULL check for img before accessing it
If opj_image_create fails to allocate an image it returns NULL, which causes a segmentation fault at 'img->x0 = 0'. Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec/libopenjpegenc.c')
-rw-r--r--libavcodec/libopenjpegenc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 95b0987..6c77527 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -200,6 +200,9 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
img = opj_image_create(numcomps, cmptparm, color_space);
+ if (!img)
+ return NULL;
+
// x0, y0 is the top left corner of the image
// x1, y1 is the width, height of the reference grid
img->x0 = 0;
OpenPOWER on IntegriCloud