rpms/netpbm/FC-4 netpbm-10.29-pnmtopng.patch, 1.1, 1.2 netpbm.spec, 1.41, 1.42

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Feb 10 12:44:53 UTC 2006


Author: jnovy

Update of /cvs/dist/rpms/netpbm/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv15866

Modified Files:
	netpbm-10.29-pnmtopng.patch netpbm.spec 
Log Message:
* Fri Feb 10 2006 Jindrich Novy <jnovy at redhat.com> 10.31-1.FC4.1
- fix segfault caused by usage of uninitialized variables while
  parsing cmdline arguments in pnmtopng (#179645)
- add validity check for date/time in pnmtopng
- fix unchecked sscanf reads



netpbm-10.29-pnmtopng.patch:
 pnmtopng.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

Index: netpbm-10.29-pnmtopng.patch
===================================================================
RCS file: /cvs/dist/rpms/netpbm/FC-4/netpbm-10.29-pnmtopng.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- netpbm-10.29-pnmtopng.patch	4 Jan 2006 12:19:36 -0000	1.1
+++ netpbm-10.29-pnmtopng.patch	10 Feb 2006 12:44:49 -0000	1.2
@@ -1,6 +1,54 @@
---- netpbm-10.29/converter/other/pnmtopng.c.segfault	2005-08-06 19:26:55.000000000 +0200
-+++ netpbm-10.29/converter/other/pnmtopng.c	2005-10-05 14:33:03.000000000 +0200
-@@ -1618,7 +1618,7 @@ makePngLine(png_byte *           const l
+--- netpbm-10.31/converter/other/pnmtopng.c.pnmtopng	2005-10-16 21:36:43.000000000 +0200
++++ netpbm-10.31/converter/other/pnmtopng.c	2006-02-10 13:32:55.000000000 +0100
+@@ -215,15 +215,12 @@ static void
+ parseModtimeOpt(const char * const modtimeOpt,
+                 time_t *     const modtimeP) {
+ 
+-    /* It would be nice to validate this better, e.g. don't accept
+-       month 42 or hour -4.
+-    */
+-
+     struct tm brokenTime;
+     int year;
+     int month;
++    int count;
+ 
+-    sscanf(modtimeOpt, "%d-%d-%d %d:%d:%d",
++    count = sscanf(modtimeOpt, "%d-%d-%d %d:%d:%d",
+            &year,
+            &month,
+            &brokenTime.tm_mday,
+@@ -231,6 +228,20 @@ parseModtimeOpt(const char * const modti
+            &brokenTime.tm_min,
+            &brokenTime.tm_sec);
+ 
++    if (count != 6) {
++    	pm_error("Invalid modtime format, it should be [yy]yy-mm-dd hh:mm:ss.");
++    	exit(EXIT_FAILURE);
++    }
++    
++    if (year < 0 || month < 0 || brokenTime.tm_mday < 0 ||
++        brokenTime.tm_hour < 0 || brokenTime.tm_min < 0 ||
++        brokenTime.tm_sec < 0 || year > 9999 || month > 12 ||
++        brokenTime.tm_mday > 31 || brokenTime.tm_hour > 23 ||
++        brokenTime.tm_min > 59 || brokenTime.tm_sec > 59) {
++        pm_error("Bad time format specified for the modtime option.");
++    	exit(EXIT_FAILURE);
++    }
++
+     brokenTime.tm_mon = month - 1;
+     if (year >= 1900)
+         brokenTime.tm_year = year - 1900;
+@@ -296,7 +307,7 @@ parseCommandLine (int argc, char ** argv
+     OPTENT3(0, "ztxt",             OPT_STRING,    &cmdlineP->ztxt,
+             &ztxtSpec,             0);
+     OPTENT3(0, "modtime",          OPT_STRING,    &modtime,
+-            &modtimeSpec,          0);
++            &cmdlineP->modtimeSpec,0);
+     OPTENT3(0, "palette",          OPT_STRING,    &cmdlineP->palette,
+             &paletteSpec,          0);
+     OPTENT3(0, "compression",      OPT_UINT,
+@@ -1973,7 +1984,7 @@ makePngLine(png_byte *           const l
              *pp++ = PNM_GET1(p_png) & 0xff;
          } else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
              unsigned int paletteIndex;
@@ -9,7 +57,7 @@
                  paletteIndex = lookupColorAlpha(caht, &p, &alpha_mask[col]);
              else
                  paletteIndex = ppm_lookupcolor(cht, &p);
-@@ -1637,7 +1637,7 @@ makePngLine(png_byte *           const l
+@@ -1992,7 +2003,7 @@ makePngLine(png_byte *           const l
          } else
              pm_error("INTERNAL ERROR: undefined color_type");
                  


Index: netpbm.spec
===================================================================
RCS file: /cvs/dist/rpms/netpbm/FC-4/netpbm.spec,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- netpbm.spec	4 Jan 2006 12:19:36 -0000	1.41
+++ netpbm.spec	10 Feb 2006 12:44:49 -0000	1.42
@@ -1,7 +1,7 @@
 Summary: A library for handling different graphics file formats.
 Name: netpbm
 Version: 10.31
-Release: 1.FC4
+Release: 1.FC4.1
 License: freeware
 Group: System Environment/Libraries
 URL: http://netpbm.sourceforge.net/
@@ -173,6 +173,12 @@
 %{_mandir}/man5/*
 
 %changelog
+* Fri Feb 10 2006 Jindrich Novy <jnovy at redhat.com> 10.31-1.FC4.1
+- fix segfault caused by usage of uninitialized variables while
+  parsing cmdline arguments in pnmtopng (#179645)
+- add validity check for date/time in pnmtopng
+- fix unchecked sscanf reads
+
 * Wed Jan 04 2006 Jindrich Novy <jnovy at redhat.com> 10.31-1.FC4
 - update to 10.31
 - update security patch




More information about the fedora-cvs-commits mailing list