File openjpeg2-CVE-2016-9113.patch of Package openjpeg2

From e0047b38dee408a63e0af72823d8a00eb8681779 Mon Sep 17 00:00:00 2001
From: Hans Petter Jansson <hpj@cl.no>
Date: Wed, 14 Dec 2016 21:34:11 +0100
Subject: [PATCH 03/10] CVE-2016-9113

---
 src/bin/jp2/convert.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c
index 40b0325..15942bf 100644
--- a/src/bin/jp2/convert.c
+++ b/src/bin/jp2/convert.c
@@ -1049,6 +1049,11 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
             && image->comps[0].prec == image->comps[1].prec
             && image->comps[1].prec == image->comps[2].prec) {
 
+        if (!image->comps[0].data || !image->comps[1].data || !image->comps[2].data) {
+            fprintf(stderr, "ERROR -> Missing image data in input file\n");
+            return 1;
+        }
+
         /* -->> -->> -->> -->>
         24 bits color
         <<-- <<-- <<-- <<-- */
@@ -1148,6 +1153,11 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
         fclose(fdest);
     } else {			/* Gray-scale */
 
+        if (!image->comps[0].data) {
+            fprintf(stderr, "ERROR -> Missing image data in input file\n");
+            return 1;
+        }
+
         /* -->> -->> -->> -->>
         8 bits non code (Gray scale)
         <<-- <<-- <<-- <<-- */
-- 
1.8.4.5