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

From 525525ecc7c70a078b5372df2484a8d0cd1c84e5 Mon Sep 17 00:00:00 2001
From: Hans Petter Jansson <hpj@cl.no>
Date: Wed, 14 Dec 2016 21:46:14 +0100
Subject: [PATCH 4/9] CVE-2016-9114

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

diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c
index ee65920..63703a8 100644
--- a/src/bin/jp2/convert.c
+++ b/src/bin/jp2/convert.c
@@ -2153,7 +2153,7 @@ if(v > 65535) v = 65535; else if(v < 0) v = 0;
         adjustR =
                 (image->comps[compno].sgnd ? 1 << (image->comps[compno].prec - 1) : 0);
 
-        if(prec > 8)
+        if(prec > 8 && red)
         {
             for (i = 0; i < wr * hr; i++)
             {
@@ -2173,7 +2173,7 @@ if(v > 65535) v = 65535; else if(v < 0) v = 0;
                 }
             }/* for(i */
         }
-        else /* prec <= 8 */
+        else if (red) /* prec <= 8 */
         {
             for(i = 0; i < wr * hr; ++i)
             {
-- 
1.8.4.5