From 796937043871aadbd0c0dc61bc90ea674ec1bc18 Mon Sep 17 00:00:00 2001 From: Alex Tutubalin Date: Fri, 24 May 2013 23:20:57 +0400 Subject: [PATCH] fixed error handling for broken full-color images --- src/external/LibRaw/src/libraw_cxx.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/external/LibRaw/src/libraw_cxx.cpp b/src/external/LibRaw/src/libraw_cxx.cpp index 218460c..977e40a 100644 --- a/src/external/LibRaw/src/libraw_cxx.cpp +++ b/src/external/LibRaw/src/libraw_cxx.cpp @@ -796,8 +796,8 @@ int LibRaw::unpack(void) S.iheight= S.height; IO.shrink = 0; // allocate image as temporary buffer, size - imgdata.rawdata.raw_alloc = calloc(S.iwidth*S.iheight,sizeof(*imgdata.image)); - imgdata.image = (ushort (*)[4]) imgdata.rawdata.raw_alloc; + imgdata.rawdata.raw_alloc = 0; + imgdata.image = (ushort (*)[4]) calloc(S.iwidth*S.iheight,sizeof(*imgdata.image)); } @@ -807,8 +807,8 @@ int LibRaw::unpack(void) // recover saved if( decoder_info.decoder_flags & LIBRAW_DECODER_LEGACY) { - imgdata.image = 0; - imgdata.rawdata.color_image = (ushort (*)[4]) imgdata.rawdata.raw_alloc; + imgdata.rawdata.raw_alloc = imgdata.rawdata.color_image = imgdata.image; + imgdata.image = 0; } // calculate channel maximum -- 1.8.3