From f7c45246c920065e901c4c2d6e9c98300902f1e8 Mon Sep 17 00:00:00 2001 From: Ingo Date: Fri, 14 Mar 2014 15:46:41 +0100 Subject: [PATCH] Floating point exception: SIGFPE, Arithmetic exception when starting RT, Issue 2222 --- rtengine/dcraw.cc | 2 ++ rtengine/dcraw.patch | 26 +++++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index bd37bba9e..dd7d45b71 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -8082,6 +8082,7 @@ konica_400z: filters = 0x16161616; } } else if (!strcmp(make,"Leica") || !strcmp(make,"Panasonic")) { + if(raw_width > 0) { // avoid divide by zero if ((flen - data_offset) / (raw_width*8/7) == raw_height) load_raw = &CLASS panasonic_load_raw; if (!load_raw) { @@ -8099,6 +8100,7 @@ konica_400z: } filters = 0x01010101 * (uchar) "\x94\x61\x49\x16" [((filters-1) ^ (left_margin & 1) ^ (top_margin << 1)) & 3]; + } } else if (!strcmp(model,"C770UZ")) { height = 1718; width = 2304; diff --git a/rtengine/dcraw.patch b/rtengine/dcraw.patch index 553342b3c..f43e1bdbe 100755 --- a/rtengine/dcraw.patch +++ b/rtengine/dcraw.patch @@ -1,5 +1,5 @@ ---- dcraw.c 2014-02-19 17:25:45.051457734 +0100 -+++ dcraw.cc 2014-02-25 15:08:30.852134339 +0100 +--- dcraw.c 2014-03-14 10:56:17 +0000 ++++ dcraw.cc 2014-03-14 10:57:48 +0000 @@ -1,3 +1,15 @@ +/*RT*/#include +/*RT*/#include @@ -936,7 +936,23 @@ width -= 46; } else if (!strcmp(model,"D4") || !strcmp(model,"Df")) { -@@ -8630,6 +8318,10 @@ +@@ -8394,6 +8082,7 @@ + filters = 0x16161616; + } + } else if (!strcmp(make,"Leica") || !strcmp(make,"Panasonic")) { ++ if(raw_width > 0) { // avoid divide by zero + if ((flen - data_offset) / (raw_width*8/7) == raw_height) + load_raw = &CLASS panasonic_load_raw; + if (!load_raw) { +@@ -8411,6 +8100,7 @@ + } + filters = 0x01010101 * (uchar) "\x94\x61\x49\x16" + [((filters-1) ^ (left_margin & 1) ^ (top_margin << 1)) & 3]; ++ } + } else if (!strcmp(model,"C770UZ")) { + height = 1718; + width = 2304; +@@ -8630,6 +8320,10 @@ memcpy (rgb_cam, cmatrix, sizeof cmatrix); raw_color = 0; } @@ -947,7 +963,7 @@ if (raw_color) adobe_coeff (make, model); if (load_raw == &CLASS kodak_radc_load_raw) if (raw_color) adobe_coeff ("Apple","Quicktake"); -@@ -8725,194 +8417,7 @@ +@@ -8725,194 +8419,7 @@ } #endif @@ -1143,7 +1159,7 @@ struct tiff_tag { ushort tag, type; -@@ -8935,585 +8440,12 @@ +@@ -8935,585 +8442,12 @@ unsigned gps[26]; char desc[512], make[64], model[64], soft[32], date[20], artist[64]; };