about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-11-02 02:57:43 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-11-02 02:57:43 +0000
commitb6eceb660067e66762977268fad6a38749dcf193 (patch)
treee1b912f747fec1561e69ca998b4b7e26cfa16752
parentc34adb82dc8d0ec0d5a66e9a5af2db18ea825c1b (diff)
downloadnetpbm-mirror-b6eceb660067e66762977268fad6a38749dcf193.tar.gz
netpbm-mirror-b6eceb660067e66762977268fad6a38749dcf193.tar.xz
netpbm-mirror-b6eceb660067e66762977268fad6a38749dcf193.zip
Release 10.73.22
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3413 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/jbig/libjbig/jbig.c2
-rw-r--r--converter/other/jpeg2000/libjasper/jpc/jpc_util.c4
-rw-r--r--converter/other/jpeg2000/pamtojpeg2k.c2
-rw-r--r--converter/ppm/picttoppm.c32
-rw-r--r--doc/HISTORY19
-rw-r--r--lib/colorname.c7
-rw-r--r--version.mk2
7 files changed, 49 insertions, 19 deletions
diff --git a/converter/other/jbig/libjbig/jbig.c b/converter/other/jbig/libjbig/jbig.c
index 1ff867e8..d7141a75 100644
--- a/converter/other/jbig/libjbig/jbig.c
+++ b/converter/other/jbig/libjbig/jbig.c
@@ -889,7 +889,7 @@ void jbg_enc_options(struct jbg_enc_state *s, int order, int options,
   if (order >= 0 && order <= 0x0f) s->order = order;
   if (options >= 0) s->options = options;
   if (l0 > 0) s->l0 = l0;
-  if (mx >= 0 && my < 128) s->mx = mx;
+  if (mx >= 0 && mx < 128) s->mx = mx;
   if (my >= 0 && my < 256) s->my = my;
 
   return;
diff --git a/converter/other/jpeg2000/libjasper/jpc/jpc_util.c b/converter/other/jpeg2000/libjasper/jpc/jpc_util.c
index 82f4b285..ecc4b914 100644
--- a/converter/other/jpeg2000/libjasper/jpc/jpc_util.c
+++ b/converter/other/jpeg2000/libjasper/jpc/jpc_util.c
@@ -151,7 +151,7 @@ int jpc_atoaf(const char *s, int *numvalues, double **values)
 	if ((cp = strtok(buf, delim))) {
 		++n;
 		while ((cp = strtok(0, delim))) {
-			if (cp != '\0') {
+			if (cp[0] != '\0') {
 				++n;
 			}
 		}
@@ -169,7 +169,7 @@ int jpc_atoaf(const char *s, int *numvalues, double **values)
 			vs[n] = atof(cp);
 			++n;
 			while ((cp = strtok(0, delim))) {
-				if (cp != '\0') {
+				if (cp[0] != '\0') {
 					vs[n] = atof(cp);
 					++n;
 				}
diff --git a/converter/other/jpeg2000/pamtojpeg2k.c b/converter/other/jpeg2000/pamtojpeg2k.c
index b8905518..142e452f 100644
--- a/converter/other/jpeg2000/pamtojpeg2k.c
+++ b/converter/other/jpeg2000/pamtojpeg2k.c
@@ -354,7 +354,7 @@ convertToJasperImage(struct pam *   const inpamP,
                                   JAS_IMAGE_CT_COLOR(JAS_IMAGE_CT_RGB_B));
         }
     } else {
-        if (strncmp(inpamP->tuple_type, "GRAYSCALE", 9 == 0) ||
+        if (strncmp(inpamP->tuple_type, "GRAYSCALE", 9) == 0 ||
             strncmp(inpamP->tuple_type, "BLACKANDWHITE", 13) == 0) {
             jas_image_setclrspc(jasperP, JAS_CLRSPC_GENGRAY);
             jas_image_setcmpttype(jasperP, 0,
diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c
index 828d5270..b14675c7 100644
--- a/converter/ppm/picttoppm.c
+++ b/converter/ppm/picttoppm.c
@@ -794,19 +794,25 @@ dumpRect(const char * const label,
 static void
 readRect(struct Rect * const r) {
 
-    r->top    = readWord();
-    r->left   = readWord();
-    r->bottom = readWord();
-    r->right  = readWord();
-
-    if (r->top > r->bottom || r->right < r->left)
-        dumpRect("Invalid rectangle", *r);
-
-    if (r->top > r->bottom)
-        pm_error("Invalid PICT: a rectangle has a top below its bottom");
-    if (r->right < r->left)
-        pm_error("Invalid PICT: a rectangle has a right edge "
-                 "left of its left edge");
+    /* We don't have a formal specification for the Pict format, but we have
+       seen samples that have the rectangle corners either in top left, bottom
+       right order or bottom right, top left.  top left, bottom right is the
+       only one Picttoppm handled until October 2018, when we saw several
+       images in the bottom right, top left order and other Pict processing
+       programs considered that fine.
+
+       So now we accept all 4 possibilities.
+    */
+
+    Word const y1 = readWord();
+    Word const x1 = readWord();
+    Word const y2 = readWord();
+    Word const x2 = readWord();
+
+    r->top    = MIN(y1, y2);
+    r->left   = MIN(x1, x2);
+    r->bottom = MAX(y1, y2);
+    r->right  = MAX(x1, x2);
 }
 
 
diff --git a/doc/HISTORY b/doc/HISTORY
index 3f69d629..fded5db4 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,25 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+18.11.02 BJH  Release 10.73.22
+
+              picttoppm: accept rectangle specifications in input that have
+              the corners in any order, not just upper left, then lower right.
+
+              libnetpbm: Fix invalid memory reference in color name processing
+              when trivial memory allocation fails.
+
+              pamtojpeg2k: fix incorrect interpretation of -ilyrrates option
+              when it contains multiple delimiter characters in a row.  Always
+              broken (pamtojpeg2k was new in Netpbm 10.12 (November 2002)).
+
+              pamtojpeg2k: Fix incorrect metadata in output with GRAYSCALE PAM
+              input.  Always broken (pamtojpeg2k was new in Netpbm 10.12
+              (November 2002)).
+
+              pnmtojbig: fix incorrect handling of -x option.  Always broken
+              (pnmtojbig was new in Netpbm 9.2 (May 2000)).
+
 18.09.29 BJH  Release 10.73.21
 
               pstopnm: Fix divide-by-zero crash when Postscript input says
diff --git a/lib/colorname.c b/lib/colorname.c
index 123de75e..83cf5d1a 100644
--- a/lib/colorname.c
+++ b/lib/colorname.c
@@ -199,7 +199,12 @@ pm_parse_dictionary_name(char    const colorname[],
     pixval r,g,b;
 
     f = pm_openColornameFile(NULL, TRUE);  /* exits if error */
-    canoncolor = strdup(colorname);
+    canoncolor = pm_strdup(colorname);
+
+    if (!canoncolor)
+        pm_error("Failed to allocate memory for %u-byte color name",
+                 (unsigned)strlen(colorname));
+
     pm_canonstr(canoncolor);
     gotit = FALSE;
     colorfileExhausted = FALSE;
diff --git a/version.mk b/version.mk
index 10fc2155..5727e98d 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 73
-NETPBM_POINT_RELEASE = 21
+NETPBM_POINT_RELEASE = 22