about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-09-01 17:52:09 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-09-01 17:52:09 +0000
commitbafee11c8c3763c5ea2c9c1365f63c321062b25e (patch)
tree4ab358ff32924371e7920a8138f51db984a938d1
parentb4f838a9bfbb656c7d24bcf1e39c616a0804f837 (diff)
downloadnetpbm-mirror-bafee11c8c3763c5ea2c9c1365f63c321062b25e.tar.gz
netpbm-mirror-bafee11c8c3763c5ea2c9c1365f63c321062b25e.tar.xz
netpbm-mirror-bafee11c8c3763c5ea2c9c1365f63c321062b25e.zip
Release 10.87.02
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3670 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/HISTORY14
-rw-r--r--version.mk2
7 files changed, 50 insertions, 7 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 a9463a57..4036f0f2 100644
--- a/converter/other/jpeg2000/libjasper/jp2/jp2_dec.c
+++ b/converter/other/jpeg2000/libjasper/jp2/jp2_dec.c
@@ -563,6 +563,9 @@ jp2_decode(jas_stream_t *in, char *optstr) {
                                   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 cada97f8..4d4dfc50 100644
--- a/converter/other/jpeg2000/libjasper/jpc/jpc_dec.c
+++ b/converter/other/jpeg2000/libjasper/jpc/jpc_dec.c
@@ -597,7 +597,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;
         }
@@ -1249,6 +1251,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;
@@ -1929,6 +1940,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 1abab392..4d9e0f32 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,20 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+19.09.01 BJH  Release 10.87.02
+
+              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)).
+
 19.08.09 BJH  Release 10.87.01
 
               pnmtorle, rletopnm: fix wild pointer dereference when a memory
diff --git a/version.mk b/version.mk
index c1e07f63..d73bc279 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 87
-NETPBM_POINT_RELEASE = 1
+NETPBM_POINT_RELEASE = 2