rpms/xv/devel xv-3.10a-png-itxt.patch, NONE, 1.1 xv-3.10a-smooth-fix2.patch, NONE, 1.1 xv.spec, 1.15, 1.16

L. Gabriel Somlo somlo at rpmfusion.org
Fri Jul 3 17:36:16 CEST 2015


Author: somlo

Update of /cvs/nonfree/rpms/xv/devel
In directory old02.ovh.rpmfusion.lan:/tmp/cvs-serv11041

Modified Files:
	xv.spec 
Added Files:
	xv-3.10a-png-itxt.patch xv-3.10a-smooth-fix2.patch 
Log Message:
* Fri Jul 03 2015 Gabriel Somlo <somlo at cmu.edu> 3.10a.jumbopatch.20070520-21
- patch by Erling A. Jacobsen to fix iTXt/utf8 png comment bug (#3131, #3704)
- patch by Erling A. Jacobsen to fix smoothing off-by-one bug (#3142)


xv-3.10a-png-itxt.patch:
 xvpng.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE xv-3.10a-png-itxt.patch ---
Prevents crash when encountering PNGs with utf8 comments

Signed-off-by: Erling A. Jacobsen <linuxcub at email.dk>

diff -ur xv-3.10a-orig/xvpng.c xv-3.10a/xvpng.c
--- xv-3.10a-orig/xvpng.c	2014-01-21 14:56:24.168673164 +0100
+++ xv-3.10a/xvpng.c	2014-01-21 15:01:02.567883070 +0100
@@ -1149,7 +1149,7 @@
 
     for (i = 0; i < _num_text; i++)
       commentsize += strlen(_text[i].key) + 1 +
-                     _text[i].text_length + 2;
+                     (_text[i].text_length ? _text[i].text_length : _text[i].itxt_length) + 2;
 
     if ((pinfo->comment = malloc(commentsize)) == NULL) {
       png_warning(png_ptr,"can't allocate comment string");

xv-3.10a-smooth-fix2.patch:
 xvsmooth.c |   39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

--- NEW FILE xv-3.10a-smooth-fix2.patch ---
Fixes off-by-one error that could cause crashes
and uses a better way of interpolating/rounding
that ensures, I think, that all the data will
be taken into account when averaging pixels.

Signed-off-by: Erling A. Jacobsen <linuxcub at email.dk>

diff -ur xv-3.10a-orig/xvsmooth.c xv-3.10a/xvsmooth.c
--- xv-3.10a-orig/xvsmooth.c	2008-02-24 20:13:53.000000000 +0100
+++ xv-3.10a/xvsmooth.c	2008-02-25 23:25:32.000000000 +0100
@@ -254,7 +254,7 @@
   bperpix = (is24) ? 3 : 1;
 
   for (j=0; j<=swide; j++)
-    pixarr[j] = (j*dwide + (15*swide)/16) / swide;
+    pixarr[j] = ((2 * j + 1 ) * dwide) / ( 2 * swide);
 
   cptr = pic824;  cptr1 = cptr + swide * bperpix;
 
@@ -369,26 +369,10 @@
 
   lastline = linecnt = 0;
 
-  for (i=0, clptr=pic824; i<=shigh; i++, clptr+=swide*bperpix) {
+  for (i=0, clptr=pic824; i<shigh; i++, clptr+=swide*bperpix) {
     ProgressMeter(0, shigh, i, "Smooth");
     if ((i&15) == 0) WaitCursor();
 
-    thisline = (i * dhigh + (15*shigh)/16) / shigh;
-
-    if (thisline != lastline) {  /* copy a line to pic24 */
-      for (j=0; j<dwide; j++) {
-	*pic24++ = lbufR[j] / linecnt;
-	*pic24++ = lbufG[j] / linecnt;
-	*pic24++ = lbufB[j] / linecnt;
-      }
-
-      xvbzero( (char *) lbufR, dwide * sizeof(int));  /* clear out line bufs */
-      xvbzero( (char *) lbufG, dwide * sizeof(int));
-      xvbzero( (char *) lbufB, dwide * sizeof(int));
-      linecnt = 0;  lastline = thisline;
-    }
-
-
     for (j=0, cxptr=cxarr; j<dwide; j++, cxptr++) {
       cptr  = clptr + *cxptr * bperpix;
       if (*cxptr < swide-1) cptr1 = cptr + 1*bperpix;
@@ -407,6 +391,21 @@
     }
 
     linecnt++;
+
+    thisline = ((2 * i + 3) * dhigh) / (2 * shigh);
+
+    if (thisline != lastline) {  /* copy a line to pic24 */
+      for (j=0; j<dwide; j++) {
+	*pic24++ = lbufR[j] / linecnt;
+	*pic24++ = lbufG[j] / linecnt;
+	*pic24++ = lbufB[j] / linecnt;
+      }
+
+      xvbzero( (char *) lbufR, dwide * sizeof(int));  /* clear out line bufs */
+      xvbzero( (char *) lbufG, dwide * sizeof(int));
+      xvbzero( (char *) lbufB, dwide * sizeof(int));
+      linecnt = 0;  lastline = thisline;
+    }
   }
 
 
@@ -463,7 +462,7 @@
   bperpix = (is24) ? 3 : 1;
 
   for (j=0; j<=swide; j++)
-    pixarr[j] = (j*dwide + (15*swide)/16) / swide;
+    pixarr[j] = ((2 * j + 1) * dwide) / (2 * swide);
 
   lastline = linecnt = pixR = pixG = pixB = 0;
   cptr = pic824;
@@ -472,7 +471,7 @@
     ProgressMeter(0, shigh, i, "Smooth");
     if ((i&15) == 0) WaitCursor();
 
-    thisline = (i * dhigh + (15*shigh)/16 ) / shigh;
+    thisline = ((2 * i + 1) * dhigh) / (2 * shigh);
 
     if ((thisline != lastline)) {      /* copy a line to pic24 */
       pixR = pixG = pixB = pixcnt = lastpix = 0;


Index: xv.spec
===================================================================
RCS file: /cvs/nonfree/rpms/xv/devel/xv.spec,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- xv.spec	22 Oct 2014 15:19:21 -0000	1.15
+++ xv.spec	3 Jul 2015 15:36:15 -0000	1.16
@@ -3,7 +3,7 @@
 
 Name: xv
 Version: %{vprog}.jumbopatch.%{vjumbo}
-Release: 20%{?dist}
+Release: 21%{?dist}
 Summary: Interactive image display program for X
 Summary(de.UTF-8): X-basierender Bild-Viewer für praktische sämtliche Grafiken
 Summary(es.UTF-8): Visualizador de imágenes para X para cuasi todos los formatos de imágenes
@@ -32,6 +32,8 @@
 Patch6: xv-3.10a-namemax.patch
 Patch7: xv-3.10a-xvcut.patch
 Patch8: xv-3.10a-format.patch
+Patch9: xv-3.10a-png-itxt.patch
+Patch10: xv-3.10a-smooth-fix2.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: libtiff-devel libpng-devel jasper-devel desktop-file-utils
 %if "%{?rhel}" != "4"
@@ -154,6 +156,12 @@
 # fix build with -Werror=format-security
 %patch8
 
+# fix crash when viewing PNGs with iTXt/utf8 comments
+%patch9
+
+# fix crash due to off-by-one smoothing bug
+%patch10
+
 # Include permission to distribute
 %{__install} -m 0644 -p %{SOURCE2} .
 
@@ -289,6 +297,10 @@
 %doc %{_docdir}/%{name}-%{vprog}/manuals/
 
 %changelog
+* Fri Jul 03 2015 Gabriel Somlo <somlo at cmu.edu> 3.10a.jumbopatch.20070520-21
+- patch by Erling A. Jacobsen to fix iTXt/utf8 png comment bug (#3131, #3704)
+- patch by Erling A. Jacobsen to fix smoothing off-by-one bug (#3142)
+
 * Wed Oct 22 2014 Paul Howarth <paul at city-fan.org> 3.10a.jumbopatch.20070520-20
 - Fix build with -Werror=format-security
 


More information about the rpmfusion-commits mailing list