LibRaw/radc_divbyzero.patch

27 lines
902 B
Diff
Raw Normal View History

2017-09-06 15:55:34 +00:00
--- a/internal/dcraw_common.cpp~ 2017-03-04 12:35:59.000000000 -0600
+++ b/internal/dcraw_common.cpp 2017-09-06 10:47:04.613293577 -0500
@@ -2716,6 +2716,10 @@
checkCancel();
#endif
FORC3 mul[c] = getbits(6);
+#ifdef LIBRAW_LIBRARY_BUILD
+ if(!mul[0] || !mul[1] || !mul[2])
+ throw LIBRAW_EXCEPTION_IO_CORRUPT;
+#endif
FORC3 {
val = ((0x1000000/last[c] + 0x7ff) >> 12) * mul[c];
s = val > 65564 ? 10:12;
--- a/dcraw/dcraw.c~ 2017-09-06 10:48:15.000000000 -0500
+++ b/dcraw/dcraw.c 2017-09-06 10:49:23.103787467 -0500
@@ -2228,6 +2228,10 @@
((short *)buf)[i] = 2048;
for (row=0; row < height; row+=4) {
FORC3 mul[c] = getbits(6);
+#ifdef LIBRAW_LIBRARY_BUILD
+ if(!mul[0] || !mul[1] || !mul[2])
+ throw LIBRAW_EXCEPTION_IO_CORRUPT;
+#endif
FORC3 {
val = ((0x1000000/last[c] + 0x7ff) >> 12) * mul[c];
s = val > 65564 ? 10:12;