about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-03-27 18:51:04 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-03-27 18:51:04 +0000
commite722d4426fa43a12dcba8369808b28af4e38b526 (patch)
tree258b7d8c8bdc28a3805348893179f3a9bece0e06
parent70281e0860cc4ef71cd1f4c25a45f45bf2cbdb6d (diff)
downloadnetpbm-mirror-e722d4426fa43a12dcba8369808b28af4e38b526.tar.gz
netpbm-mirror-e722d4426fa43a12dcba8369808b28af4e38b526.tar.xz
netpbm-mirror-e722d4426fa43a12dcba8369808b28af4e38b526.zip
Release 10.73.35
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@4072 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/pnmtopng.c7
-rw-r--r--converter/other/pnmtops.c4
-rw-r--r--converter/ppm/hpcdtoppm/Makefile2
-rw-r--r--doc/HISTORY30
-rw-r--r--editor/pamscale.c26
-rw-r--r--lib/libsystem.c20
-rw-r--r--version.mk2
7 files changed, 75 insertions, 16 deletions
diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c
index 3899a9d2..009d8bb8 100644
--- a/converter/other/pnmtopng.c
+++ b/converter/other/pnmtopng.c
@@ -962,6 +962,8 @@ tryTransparentColor(FILE *     const ifp,
             }
         }
     }  
+    *singleColorIsTransP = singleColorIsTrans;
+
     pnm_freerow(xelrow);
 }
 
@@ -1469,9 +1471,14 @@ computeUnsortedAlphaPalette(FILE *           const ifP,
     int row;
     xel * xelrow;
     unsigned int alphaColorPairCnt;
+        /* Number of different alpha/color pairs we've seen so far as we
+           iterate through the image.
+        */
 
     cht = ppm_colorhisttocolorhash(chv, colors);
 
+    /* We have not seen any alphas of any color yet. */
+    alphaColorPairCnt = 0;
     for (colorIndex = 0; colorIndex < colors; ++colorIndex) {
         alphasOfColor[colorIndex] = NULL;
         alphasOfColorCnt[colorIndex] = 0;
diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c
index c1dadc3e..200c7520 100644
--- a/converter/other/pnmtops.c
+++ b/converter/other/pnmtops.c
@@ -1011,8 +1011,8 @@ validateComputableBoundingBox(float const scols,
     float const bbWidth  = llx + scols + 0.5;
     float const bbHeight = lly + srows + 0.5;
 
-    if (bbHeight < INT_MIN || bbHeight > INT_MAX ||
-        bbWidth  < INT_MIN || bbWidth  > INT_MAX)
+    if ((double)bbHeight < INT_MIN || (double)bbHeight > INT_MAX ||
+        (double)bbWidth  < INT_MIN || (double)bbWidth  > INT_MAX)
         pm_error("Bounding box dimensions %.1f x %.1f are too large "
                  "for computations.  "
                  "This probably means input image width, height, "
diff --git a/converter/ppm/hpcdtoppm/Makefile b/converter/ppm/hpcdtoppm/Makefile
index ddf79ee5..ede71a75 100644
--- a/converter/ppm/hpcdtoppm/Makefile
+++ b/converter/ppm/hpcdtoppm/Makefile
@@ -19,7 +19,7 @@ install: install.bin.local
 install.bin.local: $(PKGDIR)/bin
 # In June 2002, pcdovtoppm replaced pcdindex
 	cd $(PKGDIR)/bin ; \
-	$(SYMLINK) pcdindex$(EXE) pcdovtoppm$(EXE)
+	$(SYMLINK) pcdovtoppm pcdindex
 
 
 FORCE:
diff --git a/doc/HISTORY b/doc/HISTORY
index cf6d36db..4f5542ea 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,36 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+21.03.27 BJH  Release 10.73.35
+
+              pamscale: fix bogus "bad magic number" or similar failure most
+              of the time with -nomix.  Broken since Netpbm 10.49 (December
+              2009).
+
+              pnmtopng: fix incorrect transparency in output when requesting
+              transparency.  Introduced after Netpbm 10.35 (August 2006) but
+              not after Netpbm 10.47 (June 2009).
+
+              pnmtopng: fix buffer overrun or bogus "too many color/
+              transparency pairs" failure when requesting transparency.
+              Introduced after Netpbm 10.26 (January 2005) but not after
+              Netpbm 10.35 (August 2006).
+
+              libnetpbm: pm_system: Fix bug: standard input feeder process
+              repositions unrelated files.  Always broken (pm_system was new
+              in Netpbm 10.13 (September 2003).
+
+              Pamtowinicon: Fix crash or incorrect output with PNG encoding
+              (result of pm_system bug above).  Always broken (Pamtowinicon
+              was new in Netpbm 10.63 (June 2013).
+
+              pnmtops: Fix incorrect output (arithmetic overflow) when
+              bounding box is exactly INT_MAX high or wide.  Always broken.
+              Pnmtops was in primordial Netpbm.
+
+              make package: fix no such file pcdovtoppm.exe failure on
+              Windows.
+
 20.12.28 BJH  Release 10.73.34
 
               pamarith: Fix bug: fails with more than two operands for
diff --git a/editor/pamscale.c b/editor/pamscale.c
index 7c6ee256..2760b298 100644
--- a/editor/pamscale.c
+++ b/editor/pamscale.c
@@ -2103,33 +2103,45 @@ scaleWithoutMixing(const struct pam * const inpamP,
 -----------------------------------------------------------------------------*/
     tuple * tuplerow;  /* An input row */
     tuple * newtuplerow;
-    int row;
-    int rowInInput;
+    unsigned int row;
+        /* The number of the next row to be output */
+    unsigned int rowInInput;
+        /* The number of the next row to be read from the input */
 
     assert(outpamP->maxval == inpamP->maxval);
     assert(outpamP->depth  == inpamP->depth);
 
     tuplerow = pnm_allocpamrow(inpamP); 
-    rowInInput = -1;
+    rowInInput = 0;
 
     newtuplerow = pnm_allocpamrow(outpamP);
 
     for (row = 0; row < outpamP->height; ++row) {
-        int col;
+        unsigned int col;
         
-        int const inputRow = (int) (row / yscale);
+        unsigned int const inputRow = (int) (row / yscale);
+            /* The number of the input row that we will use for this output
+               row.
+            */
 
-        for (; rowInInput < inputRow; ++rowInInput) 
+        for (; rowInInput <= inputRow; ++rowInInput)
             pnm_readpamrow(inpamP, tuplerow);
         
         for (col = 0; col < outpamP->width; ++col) {
-            int const inputCol = (int) (col / xscale);
+            unsigned int const inputCol = (int) (col / xscale);
             
             pnm_assigntuple(inpamP, newtuplerow[col], tuplerow[inputCol]);
         }
 
         pnm_writepamrow(outpamP, newtuplerow);
     }
+    /* Read off and discard rest of rows, because whatever is supplying the
+       input stream may expect it to be consumed and because Caller will expect
+       the stream to be positioned to the next image.
+    */
+    for (; rowInInput < inpamP->height; ++rowInInput)
+        pnm_readpamrow(inpamP, tuplerow);
+
     pnm_freepamrow(tuplerow);
     pnm_freepamrow(newtuplerow);
 }
diff --git a/lib/libsystem.c b/lib/libsystem.c
index fd3c52ec..c6b66d8c 100644
--- a/lib/libsystem.c
+++ b/lib/libsystem.c
@@ -34,8 +34,8 @@
 
 
 static void
-closeUninheritableFds(int const stdinFd,
-                      int const stdoutFd) {
+closeUninheritableFds(int const keepFdA,
+                      int const keepFdB) {
 /*----------------------------------------------------------------------------
   Close all the file descriptors that we declare uninheritable -- files Parent
   has open that Child has no business accessing.
@@ -43,14 +43,21 @@ closeUninheritableFds(int const stdinFd,
   Closing an extra file descriptor is essential to allow the file to close
   when Parent closes it.
 
+  It is also essential to prevent the system from messing with the position of
+  the file as the child process exits.  If the file descriptor is backing a
+  stream (FILE *), some process-exit code seeks the file to the current stream
+  position (from the readahead position), but having the file descriptor
+  closed defeats that.
+
   We define uninheritable as less than 64 and not Standard Input, Output,
-  or Error, or 'stdinFd' or 'stdoutFd'.
+  or Error, or 'keepFdA' or 'keepFdB'.
 -----------------------------------------------------------------------------*/
     int fd;
 
     for (fd = 0; fd < 64; ++fd) {
-        if (fd == stdinFd) {
-        } else if (fd == stdoutFd) {
+        if (false) {
+        } else if (fd == keepFdA) {
+        } else if (fd == keepFdB) {
         } else if (fd == STDIN_FILENO) {
         } else if (fd == STDOUT_FILENO) {
         } else if (fd == STDERR_FILENO) {
@@ -142,6 +149,9 @@ createPipeFeeder(void          pipeFeederRtn(int, void *),
     } else if (rc == 0) {
         /* This is the child -- the stdin feeder process */
         close(pipeToFeed[0]);
+
+        closeUninheritableFds(pipeToFeed[1], pipeToFeed[1]);
+
         (*pipeFeederRtn)(pipeToFeed[1], feederParm);
         exit(0);
     } else {
diff --git a/version.mk b/version.mk
index d4858885..e3b2496f 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 73
-NETPBM_POINT_RELEASE = 34
+NETPBM_POINT_RELEASE = 35