File openjpeg2-CVE-2016-10507.patch of Package openjpeg2.36921

diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c
index 959097e..e9d3a6a 100644
--- a/src/bin/jp2/convert.c
+++ b/src/bin/jp2/convert.c
@@ -698,6 +698,16 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
     Info_h.biClrImportant = (DWORD)(getc(IN) << 16) + Info_h.biClrImportant;
     Info_h.biClrImportant = (DWORD)(getc(IN) << 24) + Info_h.biClrImportant;
 
+    if (Info_h.biWidth == 0 || Info_h.biHeight == 0) {
+        fclose(IN);
+        return NULL;
+    }
+
+    if (Info_h.biBitCount > (((OPJ_UINT32)-1) - 31) / Info_h.biWidth) {
+        fclose(IN);
+        return NULL;
+    }
+
     /* Read the data and store them in the OUT file */
 
     if (Info_h.biBitCount == 24)
openSUSE Build Service is sponsored by