Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-updates-src > by-pkgid > bdd989ebd2d6c483842a0479d0841da8 > files > 4

rawtherapee-4.1-4.2.mga5.src.rpm

https://github.com/LibRaw/LibRaw/commit/82616eff4c7f7437e96bdeeed238c3ef3dc12d60
Index: rawtherapee-4.1/rtengine/dcraw.c
===================================================================
--- rawtherapee-4.1/rtengine/dcraw.c
+++ rawtherapee-4.1/rtengine/dcraw.c	2017-09-28 10:58:13.332691328 -0400
@@ -4292,6 +4292,10 @@
 void CLASS xtrans_interpolate (int passes)
 {
   int c, d, f, g, h, i, v, ng, row, col, top, left, mrow, mcol;
+#ifdef LIBRAW_LIBRARY_BUILD
+  int cstat[4]={0,0,0,0};
+#endif
+
   int val, ndir, pass, hm[8], avg[4], color[3][8];
   static const short orth[12] = { 1,0,0,1,-1,0,0,-1,1,0,0,1 },
 	patt[2][16] = { { 0,1,0,-1,2,0,-1,0,1,1,1,-1,0,0,0,0 },
@@ -4307,6 +4311,18 @@
   if (verbose)
     fprintf (stderr,_("%d-pass X-Trans interpolation...\n"), passes);
 
+#ifdef LIBRAW_LIBRARY_BUILD
+/* Check against right pattern */
+  for (row = 0; row < 6; row++)
+	 for (col = 0; col < 6; col++)
+		 cstat[fcol(row,col)]++;
+
+  if(cstat[0] < 6 || cstat[0]>10 || cstat[1]< 16 
+    || cstat[1]>24 || cstat[2]< 6 || cstat[2]>10 || cstat[3])
+	 throw LIBRAW_EXCEPTION_IO_CORRUPT;
+#endif
+
+
   cielab (0,0);
   border_interpolate(6);
   ndir = 4 << (passes > 1);
@@ -6305,7 +6321,11 @@
       fuji_width = !(fgetc(ifp) & 8);
     } else if (tag == 0x131) {
       filters = 9;
-      FORC(36) xtrans[0][35-c] = fgetc(ifp) & 3;
+      FORC(36)
+	{
+	   int q = fgetc(ifp);
+	   xtrans_abs[0][35 - c] = MAX(0,MIN(q,2)); /* & 3;*/
+	}
     } else if (tag == 0x2ff0) {
       FORC4 cam_mul[c ^ 1] = get2();
     } else if (tag == 0xc000) {