about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-01-29 04:19:22 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-01-29 04:19:22 +0000
commit23f5ae1861b268c4adcdaec6657406328dfdf811 (patch)
tree2dbb6a655764b3684f6d2877e3323a03ee00f623
parent3976c04edc6d4bdb583875176e06f93fc23d869f (diff)
downloadnetpbm-mirror-23f5ae1861b268c4adcdaec6657406328dfdf811.tar.gz
netpbm-mirror-23f5ae1861b268c4adcdaec6657406328dfdf811.tar.xz
netpbm-mirror-23f5ae1861b268c4adcdaec6657406328dfdf811.zip
Release 10.35.59
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@832 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--Makefile.version2
-rw-r--r--converter/other/fitstopnm.c18
-rw-r--r--converter/ppm/ilbmtoppm.c4
-rw-r--r--doc/HISTORY8
4 files changed, 29 insertions, 3 deletions
diff --git a/Makefile.version b/Makefile.version
index 490671f4..6cd979ab 100644
--- a/Makefile.version
+++ b/Makefile.version
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 35
-NETPBM_POINT_RELEASE = 58
+NETPBM_POINT_RELEASE = 59
diff --git a/converter/other/fitstopnm.c b/converter/other/fitstopnm.c
index b143882b..b4240d63 100644
--- a/converter/other/fitstopnm.c
+++ b/converter/other/fitstopnm.c
@@ -359,6 +359,22 @@ main(int argc, char * argv[]) {
     exit( 0 );
 }
 
+
+static void
+swapbytes(void *       const p,
+          unsigned int const nbytes) {
+#if BYTE_ORDER == LITTLE_ENDIAN
+    unsigned char * const c = p;
+    unsigned int i;
+    for (i = 0; i < nbytes/2; ++i) {
+        unsigned char const orig = c[i];
+        c[i] = c[nbytes-(i+1)];
+        c[nbytes-(i+1)] = orig;
+    }
+#endif
+}
+
+
 /*
  ** This code will deal properly with integers, no matter what the byte order
  ** or integer size of the host machine.  Sign extension is handled manually
@@ -427,6 +443,7 @@ read_val (fp, bitpix, vp)
                 pm_error( "EOF / read error" );
             c[i] = ich;
         }
+        swapbytes(c, 4);
         *vp = *( (float *) c);
         break;
       
@@ -437,6 +454,7 @@ read_val (fp, bitpix, vp)
                 pm_error( "EOF / read error" );
             c[i] = ich;
         }
+        swapbytes(c, 8);
         *vp = *( (double *) c);
         break;
       
diff --git a/converter/ppm/ilbmtoppm.c b/converter/ppm/ilbmtoppm.c
index fafbd005..c88cdfb2 100644
--- a/converter/ppm/ilbmtoppm.c
+++ b/converter/ppm/ilbmtoppm.c
@@ -1675,7 +1675,7 @@ PCHG_Decompress(PCHG, CompHdr, compdata, compsize, comptree, data)
 #endif
             /* turn big-endian 2-byte shorts into native format */
             huffsize = treesize/2;
-            MALLOCVAR_NOFAIL(hufftree);
+            MALLOCARRAY_NOFAIL(hufftree, huffsize);
             for( i = 0; i < huffsize; i++ ) {
                 hufftree[i] = (short)BIG_WORD(comptree);
                 comptree += 2;
@@ -1932,7 +1932,7 @@ read_pchg(FILE *     const ifp,
                 get_big_long(ifp, iffid, &remainingChunksize);
 
             treesize = CompHdr.CompInfoSize;
-            MALLOCVAR_NOFAIL(comptree);
+            MALLOCARRAY_NOFAIL(comptree, treesize);
             read_bytes(ifp, treesize, comptree, iffid, &remainingChunksize);
 
             compsize = remainingChunksize;
diff --git a/doc/HISTORY b/doc/HISTORY
index 9262a0c7..7a6d106e 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,14 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+09.01.29 BJH  Release 10.35.59
+
+              ilbmtoppm: Fix array bound violation with compressed ILBM.
+              Introduced in 10.18.
+
+              fitstopnm: fix garbage output when input is little endian
+              floating point FITS.
+
 09.01.15 BJH  Release 10.35.58
 
               picttoppm: fix crash when image is all text with -fullres.