about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-09-28 19:14:30 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-09-28 19:14:30 +0000
commit425de37d2f9cde3b624819d5cb326e11afaf355e (patch)
treea2a49abd32eba5c4f27a77b9ea42389c5008c709
parent11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32 (diff)
downloadnetpbm-mirror-425de37d2f9cde3b624819d5cb326e11afaf355e.tar.gz
netpbm-mirror-425de37d2f9cde3b624819d5cb326e11afaf355e.tar.xz
netpbm-mirror-425de37d2f9cde3b624819d5cb326e11afaf355e.zip
Release 10.73.29
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3687 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_image.c4
-rw-r--r--converter/other/jpeg2000/libjasper/jp2/jp2_dec.c3
-rw-r--r--converter/other/jpeg2000/libjasper/jpc/jpc_dec.c23
-rw-r--r--converter/other/jpeg2000/libjasper/jpc/jpc_math.c4
-rw-r--r--converter/other/jpeg2000/libjasper/jpc/jpc_math.h7
-rw-r--r--doc/HISTORY17
-rw-r--r--urt/rle_error.c2
-rw-r--r--version.mk2
8 files changed, 54 insertions, 8 deletions
diff --git a/converter/other/jpeg2000/libjasper/base/jas_image.c b/converter/other/jpeg2000/libjasper/base/jas_image.c
index 903b45c6..5c2822be 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_image.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_image.c
@@ -885,6 +885,10 @@ int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
 	cmptparms.prec = JAS_IMAGE_CDT_GETPREC(dtype);
 	cmptparms.sgnd = JAS_IMAGE_CDT_GETSGND(dtype);
 
+	if (numlutents < 1) {
+		return -1;
+	}
+
 	if (jas_image_addcmpt(image, newcmptno, &cmptparms)) {
 		return -1;
 	}
diff --git a/converter/other/jpeg2000/libjasper/jp2/jp2_dec.c b/converter/other/jpeg2000/libjasper/jp2/jp2_dec.c
index 91ce6c51..55c5449d 100644
--- a/converter/other/jpeg2000/libjasper/jp2/jp2_dec.c
+++ b/converter/other/jpeg2000/libjasper/jp2/jp2_dec.c
@@ -418,6 +418,9 @@ jas_image_t *jp2_decode(jas_stream_t *in, char *optstr)
 				jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_colorspace(dec->image), 0, channo + 1));
 				}
 #endif
+            } else {
+                jas_eprintf("error: invalid MTYP in CMAP box\n");
+                goto error;
 			}
 		}
 	}
diff --git a/converter/other/jpeg2000/libjasper/jpc/jpc_dec.c b/converter/other/jpeg2000/libjasper/jpc/jpc_dec.c
index 72bd0126..92150525 100644
--- a/converter/other/jpeg2000/libjasper/jpc/jpc_dec.c
+++ b/converter/other/jpeg2000/libjasper/jpc/jpc_dec.c
@@ -595,7 +595,9 @@ static int jpc_dec_process_sod(jpc_dec_t *dec, jpc_ms_t *ms)
         if (!jpc_dec_cp_isvalid(tile->cp)) {
             return -1;
         }
-        jpc_dec_cp_prepare(tile->cp);
+        if (jpc_dec_cp_prepare(tile->cp)) {
+            return -1;
+        }
         if (jpc_dec_tileinit(dec, tile)) {
             return -1;
         }
@@ -1250,6 +1252,15 @@ static int jpc_dec_process_siz(jpc_dec_t *dec, jpc_ms_t *ms)
         return -1;
     }
 
+    for (tileno = 0, tile = dec->tiles;
+         tileno < dec->numtiles;
+         ++tileno, ++tile) {
+        /* initialize all tiles with JPC_TILE_DONE so jpc_dec_destroy() knows
+           which ones need a jpc_dec_tilefini() call; they are not actually
+           "done", of course */
+        tile->state = JPC_TILE_DONE;
+    }
+
     for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,
       ++tile) {
         htileno = tileno % dec->numhtiles;
@@ -1930,6 +1941,16 @@ static void jpc_dec_destroy(jpc_dec_t *dec)
     }
 
     if (dec->tiles) {
+        int tileno;
+        jpc_dec_tile_t *tile;
+
+        for (tileno = 0, tile = dec->tiles;
+             tileno < dec->numtiles;
+             ++tileno, ++tile) {
+            if (tile->state != JPC_TILE_DONE) {
+                jpc_dec_tilefini(dec, tile);
+            }
+        }
         jas_free(dec->tiles);
     }
 
diff --git a/converter/other/jpeg2000/libjasper/jpc/jpc_math.c b/converter/other/jpeg2000/libjasper/jpc/jpc_math.c
index 72e3ac37..01e3611e 100644
--- a/converter/other/jpeg2000/libjasper/jpc/jpc_math.c
+++ b/converter/other/jpeg2000/libjasper/jpc/jpc_math.c
@@ -12,7 +12,7 @@
 /* Calculate the integer quantity floor(log2(x)), where x is a positive
   integer. */
 int
-jpc_floorlog2(int const arg) {
+jpc_floorlog2(int_fast32_t const arg) {
 
 	int y;
     int x;
@@ -46,7 +46,7 @@ jpc_firstone(n)    :-1 0  1  1  2  2  2  2  3  3  3  3  3  3  3  3  4  4  4  4
 
 
 int
-jpc_firstone(int const arg) {
+jpc_firstone(int_fast32_t const arg) {
 /*---------------------------------------------------------------------------- 
   Calculate the bit position of the first leading one in a nonnegative
   integer.
diff --git a/converter/other/jpeg2000/libjasper/jpc/jpc_math.h b/converter/other/jpeg2000/libjasper/jpc/jpc_math.h
index 77df0c62..cd24c6a6 100644
--- a/converter/other/jpeg2000/libjasper/jpc/jpc_math.h
+++ b/converter/other/jpeg2000/libjasper/jpc/jpc_math.h
@@ -115,7 +115,8 @@
 * Includes
 \******************************************************************************/
 
-#include	<assert.h>
+#include <assert.h>
+#include <stdint.h>
 
 /******************************************************************************\
 * Macros
@@ -146,10 +147,10 @@
 
 /* Calculate the bit position of the first leading one in a nonnegative
   integer. */
-int jpc_firstone(int x);
+int jpc_firstone(int_fast32_t x);
 
 /* Calculate the integer quantity floor(log2(x)), where x is a positive
   integer. */
-int jpc_floorlog2(int x);
+int jpc_floorlog2(int_fast32_t x);
 
 #endif
diff --git a/doc/HISTORY b/doc/HISTORY
index 5f91d170..202d038e 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,23 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+19.09.28 BJH  Release 10.73.29
+
+              jpeg2ktopam, pamtojpeg2k: fix negative array index.  Always
+              broken (pamtojpeg2k was new in Netpbm 10.12 (November 2002)).
+
+              jpeg2ktopam, pamtojpeg2k: fix assertion failure.  Always
+              broken (pamtojpeg2k was new in Netpbm 10.12 (November 2002)).
+
+              jpeg2ktopam: Fix memory leak after decoder failure.  Always
+              broken (pamtojpeg2k was new in Netpbm 10.12 (November 2002)).
+
+              jpeg2ktopam: fix null pointer dereference.  Always broken
+              (pamtojpeg2k was new in Netpbm 10.12 (November 2002)).
+
+              pnmtorle, rletopnm: fix wild pointer dereference when a memory
+              allocation fails.
+
 19.06.28 BJH  Release 10.73.28
 
               pbmtozinc: fix wrong output on big-endian machines.  Broken in
diff --git a/urt/rle_error.c b/urt/rle_error.c
index da314f0b..702c6e2d 100644
--- a/urt/rle_error.c
+++ b/urt/rle_error.c
@@ -46,7 +46,7 @@ int
 rle_alloc_error( pgm, name )
 CONST_DECL char *pgm, *name;
 {
-    if ( name )
+    if ( !name )
 	fprintf( stderr, "%s: memory allocation failed.\n", pgm );
     else
 	fprintf( stderr, "%s: memory allocation failed (no space for %s).\n",
diff --git a/version.mk b/version.mk
index 2dbfb7ff..9cc9e45e 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 73
-NETPBM_POINT_RELEASE = 28
+NETPBM_POINT_RELEASE = 29