File libraw-CVE-2018-20363,20364,20365.patch of Package libraw.38394
Index: LibRaw-0.15.4/src/libraw_cxx.cpp
===================================================================
--- LibRaw-0.15.4.orig/src/libraw_cxx.cpp 2019-01-09 10:57:04.094096143 +0100
+++ LibRaw-0.15.4/src/libraw_cxx.cpp 2019-01-09 11:00:23.643005916 +0100
@@ -1261,7 +1261,7 @@ int LibRaw::raw2image(void)
try {
raw2image_start();
- if (is_phaseone_compressed())
+ if (is_phaseone_compressed() && imgdata.rawdata.raw_alloc)
{
phase_one_allocate_tempbuffer();
phase_one_subtract_black((ushort*)imgdata.rawdata.raw_alloc,imgdata.rawdata.raw_image);
@@ -1283,7 +1283,7 @@ int LibRaw::raw2image(void)
get_decoder_info(&decoder_info);
// Move saved bitmap to imgdata.image
- if(decoder_info.decoder_flags & LIBRAW_DECODER_FLATFIELD)
+ if(decoder_info.decoder_flags & LIBRAW_DECODER_FLATFIELD && imgdata.rawdata.raw_image)
{
if (IO.fuji_width) {
unsigned r,c;
@@ -1512,7 +1512,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();
phase_one_subtract_black((ushort*)imgdata.rawdata.raw_alloc,imgdata.rawdata.raw_image);
@@ -1614,7 +1614,7 @@ int LibRaw::raw2image_ex(int do_subtract
}
// Move saved bitmap to imgdata.image
- if(decoder_info.decoder_flags & LIBRAW_DECODER_FLATFIELD)
+ if(decoder_info.decoder_flags & LIBRAW_DECODER_FLATFIELD && imgdata.rawdata.raw_image)
{
if (IO.fuji_width)
{