about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-05-18 00:06:03 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-05-18 00:06:03 +0000
commitd48a2029915d779215178261f3a529b10acb992a (patch)
treeb04f14927f916e66a80a30dc4ccd6deb242b787e
parente165d1d85c5e1ee87540d2e326f97e4d539cfee0 (diff)
downloadnetpbm-mirror-d48a2029915d779215178261f3a529b10acb992a.tar.gz
netpbm-mirror-d48a2029915d779215178261f3a529b10acb992a.tar.xz
netpbm-mirror-d48a2029915d779215178261f3a529b10acb992a.zip
Release 10.70.05
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2495 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/jbig/Makefile3
-rw-r--r--converter/other/jpeg2000/Makefile3
-rw-r--r--converter/pbm/pbmtomacp.c19
-rw-r--r--converter/pbm/pbmtomgr.c13
-rw-r--r--converter/pbm/pbmtoxbm.c19
-rw-r--r--doc/HISTORY16
-rw-r--r--doc/Netpbm.programming5
-rw-r--r--doc/USERDOC7
-rw-r--r--version.mk2
9 files changed, 61 insertions, 26 deletions
diff --git a/converter/other/jbig/Makefile b/converter/other/jbig/Makefile
index 946cb732..c4d7e9d6 100644
--- a/converter/other/jbig/Makefile
+++ b/converter/other/jbig/Makefile
@@ -5,7 +5,7 @@ endif
 SUBDIR = converter/other/jbig
 VPATH=.:$(SRCDIR)/$(SUBDIR)
 
-SUBDIRS = libjbig
+SUBDIRS =
 
 include $(BUILDDIR)/config.mk
 
@@ -35,6 +35,7 @@ SCRIPTS =
 
 ifeq ($(JBIGLIB),$(INTERNAL_JBIGLIB))
   JBIGLIB_DEP = $(JBIGLIB)
+  SUBDIRS += libjbig
 else
   # It's not our internal version; user's on his own to make sure it's built
 endif
diff --git a/converter/other/jpeg2000/Makefile b/converter/other/jpeg2000/Makefile
index 009232d7..6e5af8e7 100644
--- a/converter/other/jpeg2000/Makefile
+++ b/converter/other/jpeg2000/Makefile
@@ -5,7 +5,7 @@ endif
 SUBDIR = converter/other/jpeg2000
 VPATH=.:$(SRCDIR)/$(SUBDIR)
 
-SUBDIRS = libjasper
+SUBDIRS =
 
 include $(BUILDDIR)/config.mk
 
@@ -52,6 +52,7 @@ ifeq ($(JASPERLIB),$(INTERNAL_JASPERLIB))
   # MERGE_OBJECTS contains relative paths, so $(INTERNAL_JASPERLIB) had better
   # be relative to the current directory.
   MERGE_OBJECTS += $(JASPERLIB)
+  SUBDIRS += libjasper
 endif
 MERGEBINARIES = $(BINARIES)
 
diff --git a/converter/pbm/pbmtomacp.c b/converter/pbm/pbmtomacp.c
index 4dd819db..82ccce06 100644
--- a/converter/pbm/pbmtomacp.c
+++ b/converter/pbm/pbmtomacp.c
@@ -19,6 +19,8 @@
 #define EQUAL		1
 #define UNEQUAL		0
 
+#define MIN3(a,b,c)     (MIN((MIN((a),(b))),(c)))
+
 static void fillbits ARGS(( bit **bits, bit **bitsr, int top, int left, int bottom, int right ));
 static void writemacp ARGS(( bit **bits ));
 static int packit ARGS(( bit *pb, bit *bits ));
@@ -101,23 +103,18 @@ char *argv[];
     left = 0;
 
   if( rflg )
-  { if( right - left >= MAX_COLS )
-      right = left + MAX_COLS - 1;
-  }
+    right = MIN3( right, cols - 1, left + MAX_COLS - 1 );
   else
-    right = ( left + MAX_COLS > cols ) ? ( cols - 1 ) : ( left + MAX_COLS - 1 );
+    right = MIN( cols - 1,  left + MAX_COLS - 1 );
 
   if( !tflg )
     top = 0;
 
   if( bflg )
-  { if( bottom - top >= MAX_LINES )
-      bottom = top + MAX_LINES - 1;
-  }
+    bottom = MIN3( bottom, rows - 1, top + MAX_LINES - 1);
   else
-    bottom = ( top + MAX_LINES > rows ) ?
-		   ( rows - 1 ) : ( top + MAX_LINES - 1 );
-  
+    bottom = MIN( rows - 1, top + MAX_LINES - 1 );
+
     if( right <= left || left < 0 || right - left + 1 > MAX_COLS )
       pm_error("error in right (= %d) and/or left (=%d)",right,left );
     if( bottom <= top || top < 0 || bottom - top + 1 > MAX_LINES )
@@ -219,7 +216,7 @@ packit( pb, bits )
       save = *srcb++;
       charcount--;
       newcount = 1;
-      while( (*srcb == save) && charcount ) { 
+      while( charcount && (*srcb == save) ) { 
           srcb++;
           newcount++;
           charcount--;
diff --git a/converter/pbm/pbmtomgr.c b/converter/pbm/pbmtomgr.c
index 2ca7c7d0..d12e6635 100644
--- a/converter/pbm/pbmtomgr.c
+++ b/converter/pbm/pbmtomgr.c
@@ -6,9 +6,12 @@
    ftp://sunsite.unc.edu/pub/Linux/apps/MGR/!INDEX.html
 */
 
+#include <assert.h>
 #include "pbm.h"
 #include "mgr.h"
 
+
+
 static void
 putinit(unsigned int const rows,
         unsigned int const cols) {
@@ -16,6 +19,10 @@ putinit(unsigned int const rows,
     struct b_header head;
     size_t writtenCount;
 
+    /* Because of argument restrictions: maximum dimensions: */
+    assert((rows & 0xfff) == rows);
+    assert((cols & 0xfff) == cols);
+
     head.magic[0] = 'y';
     head.magic[1] = 'z';
     head.h_wide = ((cols >> 6) & 0x3f) + ' ';
@@ -48,6 +55,8 @@ main(int argc,
            a multiple of 8, i.e. an integral number of packed bytes.
         */
     const char * inputFileName;
+    unsigned int const maxDimension = 4095;
+        /* Dimensions are 2 characters of the header -- 12 bits */
 
     pbm_init(&argc, argv);
 
@@ -62,6 +71,10 @@ main(int argc,
     ifP = pm_openr(inputFileName);
 
     pbm_readpbminit(ifP, &cols, &rows, &format);
+    if (cols > maxDimension)
+        pm_error("Image width too large: %u (max: %u)", cols, maxDimension);
+    if (rows > maxDimension)
+        pm_error("Image height too large: %u (max: %u)", rows, maxDimension);
     
     bitrow = pbm_allocrow_packed(cols);
     bytesPerRow = pbm_packed_bytes(cols);
diff --git a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c
index 2b59a17c..c6c4a9e6 100644
--- a/converter/pbm/pbmtoxbm.c
+++ b/converter/pbm/pbmtoxbm.c
@@ -249,7 +249,7 @@ puttermX10(void) {
                     (i == 0) ? " " : "",
                     itemBuff[i+1],
                     itemBuff[i], 
-                    (i == itemCnt - 2) ? "};\n" : ",");
+                    (i == itemCnt - 2) ? "" : ",");
         if (rc < 0)        
             pm_error("Error writing end of X10 bitmap raster.  "
                      "printf() failed with errno %d (%s)",
@@ -270,7 +270,7 @@ puttermX11(void) {
         rc = printf("%s0x%02x%s",
                     (i == 0)  ? " " : "",
                     itemBuff[i],
-                    (i == itemCnt - 1) ? "};\n" : ",");
+                    (i == itemCnt - 1) ? "" : ",");
 
         if (rc < 0)        
             pm_error("Error writing end of X11 bitmap raster.  "
@@ -297,6 +297,17 @@ putterm(void) {
     case X10: puttermX10(); break;
     case X11: puttermX11(); break;
     }
+
+    {
+        int rc;
+
+        rc = printf("};\n");
+
+        if (rc < 0)        
+            pm_error("Error writing end of X11 bitmap raster.  "
+                     "printf() failed with errno %d (%s)",
+                     errno, strerror(errno));
+    }
 }
 
 
@@ -339,7 +350,6 @@ convertRaster(FILE *          const ifP,
     putinit(xbmVersion);
 
     bitrow = pbm_allocrow_packed(cols + padright);
-    bitrow[bitrowBytes-1] = 0;
     
     for (row = 0; row < rows; ++row) {
         int const bitrowInBytes = pbm_packed_bytes(cols);
@@ -354,6 +364,9 @@ convertRaster(FILE *          const ifP,
             bitrow[bitrowInBytes - 1] <<= padrightIn;
         }
 
+        if (padright >= 8)
+            bitrow[bitrowBytes-1] = 0x00;
+
         for (i = 0; i < bitrowBytes; ++i)
             putitem(bitrow[i]);
     }
diff --git a/doc/HISTORY b/doc/HISTORY
index 0dd02828..ff28d250 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,22 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+15.05.18 BJH  Release 10.70.05
+
+              pbmtoxbm: Fix bug: crash with zero width input.  Broken in
+              Netpbm 10.37 (December 2006).
+
+              pbmtomgr: Fix incorrect output when input is too large (must be
+              at most 4095 pixels high or wide).  Always broken.  (pbmtomgr
+              was new in 1989).
+
+              pbmtomacp: fix wild pointer dereference with -b larger than
+              image height.  Always broken.  (pbmtomacp was new in X.V11R3
+              (March 1988).
+
+              Build: don't build and install libjbig and libjasper if we
+              are using external versions of them instead.
+
 15.04.30 BJH  Release 10.70.04
 
               pnmconvol: Fix bug: wrong output for pixels that convolve to
diff --git a/doc/Netpbm.programming b/doc/Netpbm.programming
index bd1c3596..62e4c569 100644
--- a/doc/Netpbm.programming
+++ b/doc/Netpbm.programming
@@ -57,9 +57,8 @@ the conventional Unix means of communicating code changes.  A Subversion
 You should update or create documentation too.  But if you don't, the Netpbm
 maintainer will do the update before releasing your code.  The source files
 for the documentation are the HTML files in the 'userguide' directory of the
-Netpbm Subversion repository:
-http://netpbm.svn.sourceforge.net/svnroot/netpbm/userguide .  The identical
-files are at http://netpbm.sourceforge.net/doc/ .
+Netpbm Subversion repository: https://svn.code.sf.net/p/netpbm/code/userguide.
+The identical files are at http://netpbm.sourceforge.net/doc/ .
 
 There are some automated tests in the package - shell scripts in files
 named such as "pbmtog3.test".  You can use those to verify your
diff --git a/doc/USERDOC b/doc/USERDOC
index f067059a..9d883849 100644
--- a/doc/USERDOC
+++ b/doc/USERDOC
@@ -25,17 +25,12 @@ to the Internet), just make a local copy of the HTML files.
 You can get the files from the Subversion repository using the Subversion
 client program 'svn':
 
-  URL=https://netpbm.svn.sourceforge.net/svnroot/netpbm/userguide
+  URL=https://svn.code.sf.net/p/netpbm/code/userguide
   svn export $URL
 
 This creates a directory "userguide" in your current directory containing
 all the same files that are on the web site.
 
-And a sometimes more convenient way to get those files from the Subversion
-repository is to get Sourceforge's Viewvc service to make a tarball of them:
-
-  wget http://netpbm.svn.sourceforge.net/viewvc/netpbm/userguide.tar.gz?view=tar --output-document=/tmp/userguide.tgz
-
 
 An apparent alternative is just to copy the web site with something like GNU
 Wget.  However, the Sourceforge web server has limitations on how much you can
diff --git a/version.mk b/version.mk
index 365b9b1d..77b77811 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 70
-NETPBM_POINT_RELEASE = 4
+NETPBM_POINT_RELEASE = 5