File libraw-CVE-2018-20363,20364,20365.patch of Package libraw.openSUSE_Leap_15.2_Update

Index: LibRaw-0.18.9/src/libraw_cxx.cpp
===================================================================
--- LibRaw-0.18.9.orig/src/libraw_cxx.cpp	2019-01-09 10:52:58.244975273 +0100
+++ LibRaw-0.18.9/src/libraw_cxx.cpp	2019-01-09 10:54:55.077507927 +0100
@@ -2750,7 +2750,7 @@ int LibRaw::raw2image(void)
   try {
     raw2image_start();
 
-    if (is_phaseone_compressed())
+    if (is_phaseone_compressed() && imgdata.rawdata.raw_alloc)
       {
         phase_one_allocate_tempbuffer();
         int rc = phase_one_subtract_black((ushort*)imgdata.rawdata.raw_alloc,imgdata.rawdata.raw_image);
@@ -2778,7 +2778,7 @@ int LibRaw::raw2image(void)
     get_decoder_info(&decoder_info);
 
     // Move saved bitmap to imgdata.image
-    if( imgdata.idata.filters || P1.colors == 1)
+    if((imgdata.idata.filters || P1.colors == 1) && imgdata.rawdata.raw_image)
       {
         if (IO.fuji_width) {
           unsigned r,c;
@@ -3028,7 +3028,7 @@ int LibRaw::raw2image_ex(int do_subtract
     raw2image_start();
 
     // Compressed P1 files with bl data!
-    if (is_phaseone_compressed())
+    if (is_phaseone_compressed() && imgdata.rawdata.raw_alloc)
       {
         phase_one_allocate_tempbuffer();
         int rc = phase_one_subtract_black((ushort*)imgdata.rawdata.raw_alloc,imgdata.rawdata.raw_image);
@@ -3140,7 +3140,7 @@ int LibRaw::raw2image_ex(int do_subtract
       }
 
     // Move saved bitmap to imgdata.image
-    if(imgdata.idata.filters || P1.colors == 1)
+    if((imgdata.idata.filters || P1.colors == 1) && imgdata.rawdata.raw_image)
       {
         if (IO.fuji_width)
           {
openSUSE Build Service is sponsored by