about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-01-31 16:44:56 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-01-31 16:44:56 +0000
commit1f50dd91377f74df01e767d6a8d8dac8562ccd48 (patch)
tree37beed81abc008568d7d3a1140e85022493327ed
parent3eaf18cfead86bced6c36e517b1738d872ff9e49 (diff)
downloadnetpbm-mirror-1f50dd91377f74df01e767d6a8d8dac8562ccd48.tar.gz
netpbm-mirror-1f50dd91377f74df01e767d6a8d8dac8562ccd48.tar.xz
netpbm-mirror-1f50dd91377f74df01e767d6a8d8dac8562ccd48.zip
Release 10.47.26
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@1402 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/pngtopnm.c16
-rw-r--r--converter/pgm/asciitopgm.c19
-rw-r--r--doc/HISTORY9
-rw-r--r--version.mk2
4 files changed, 39 insertions, 7 deletions
diff --git a/converter/other/pngtopnm.c b/converter/other/pngtopnm.c
index ffb98ef7..8a34df0d 100644
--- a/converter/other/pngtopnm.c
+++ b/converter/other/pngtopnm.c
@@ -32,6 +32,14 @@
 #include "shhopt.h"
 #include "pnm.h"
 
+/* A hack until we can remove direct access to png_info from the program */
+#if PNG_LIBPNG_VER >= 10400
+#define TRANS_ALPHA trans_alpha
+#else
+#define TRANS_ALPHA trans
+#endif
+
+
 enum alpha_handling {ALPHA_NONE, ALPHA_ONLY, ALPHA_MIX};
 
 struct cmdlineInfo {
@@ -725,8 +733,8 @@ paletteHasPartialTransparency(png_info * const info_ptr) {
             for (i = 0, foundGray = FALSE;
                  i < info_ptr->num_trans && !foundGray;
                  ++i) {
-                if (info_ptr->trans[i] != 0 &&
-                    info_ptr->trans[i] != maxval) {
+                if (info_ptr->TRANS_ALPHA[i] != 0 &&
+                    info_ptr->TRANS_ALPHA[i] != maxval) {
                     foundGray = TRUE;
                 }
             }
@@ -798,7 +806,7 @@ setupSignificantBits(struct pngx *       const pngxP,
                 unsigned int i;
                 trans_mix = TRUE;
                 for (i = 0; i < info_ptr->num_trans; ++i)
-                    if (info_ptr->trans[i] != 0 && info_ptr->trans[i] != 255) {
+                    if (info_ptr->TRANS_ALPHA[i] != 0 && info_ptr->TRANS_ALPHA[i] != 255) {
                         trans_mix = FALSE;
                         break;
                     }
@@ -1061,7 +1069,7 @@ makeXelRow(xel *               const xelrow,
             setXel(&xelrow[col], fgColor, bgColor, alphaHandling,
                    (pngxP->info_ptr->valid & PNG_INFO_tRNS) &&
                    index < pngxP->info_ptr->num_trans ?
-                   pngxP->info_ptr->trans[index] : maxval);
+                   pngxP->info_ptr->TRANS_ALPHA[index] : maxval);
         }
         break;
                 
diff --git a/converter/pgm/asciitopgm.c b/converter/pgm/asciitopgm.c
index 6cc24025..a3a5bd48 100644
--- a/converter/pgm/asciitopgm.c
+++ b/converter/pgm/asciitopgm.c
@@ -55,6 +55,7 @@ main( argc, argv )
     bool warned;
     int *obuf;
     const char * const usage = "[-d <val>] height width [asciifile]";
+    char trunc;
 
     pgm_init( &argc, argv );
 
@@ -112,7 +113,7 @@ main( argc, argv )
         for (col = 0; col < cols; ++col) obuf[col] = 0;
     }
     grays = pgm_allocarray( cols, rows );
-    row = i = 0;
+    row = i = trunc = 0;
     while ( row < rows )
     {
         switch (c = getc (ifd))
@@ -120,6 +121,8 @@ main( argc, argv )
         case EOF:
             goto line_done;
         case '\n':
+	newline:
+	    trunc = 0;
             if ((c = getc (ifd)) == EOF)
                 goto line_done;
             if (c == '+')
@@ -137,11 +140,23 @@ main( argc, argv )
                 ++row;
                 if ( row >= rows )
                     break;
-                if (c != EOF)
+		if (c == '\n')
+		    goto newline;
+                else if (c != EOF)
                     obuf[i++] += gmap[c];
             }
             break;
         default:
+	    if (i == cols)
+	    {
+		if (! trunc)
+		{
+		    pm_message("Warning: row %d being truncated at %d columns",
+			       row+1, cols);
+		    trunc = 1;
+		}
+		continue;
+	    }
             if (c > 0x7f)       /* !isascii(c) */
             {
                 if (!warned)
diff --git a/doc/HISTORY b/doc/HISTORY
index 37dcefb0..4a3ef349 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,15 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+11.01.31 BJH  Release 10.47.26
+
+              asciitopgm: fix bug: memory corruption on too-long lines.
+
+              asciitopgm: fix bug: improper handling of blank lines.
+              
+              Build: compiles with libpng 1.4.  (This was done in 10.47.04
+              too, but apparently didn't work).
+
 11.01.15 BJH  Release 10.47.25
 
               pngtopam: fix bug: -verbose reports history chunk present when
diff --git a/version.mk b/version.mk
index 0a24a6e5..5926a2b2 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 47
-NETPBM_POINT_RELEASE = 25
+NETPBM_POINT_RELEASE = 26