about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2008-02-01 21:32:39 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2008-02-01 21:32:39 +0000
commita3e310fee27a93dbe114fe24bd0c2b7e7b60f5c1 (patch)
tree005d6737ec960e5b10a993147bb13ad9fea07534
parent0e3537400827bbe63e6b49968ab4c959dbad145d (diff)
downloadnetpbm-mirror-a3e310fee27a93dbe114fe24bd0c2b7e7b60f5c1.tar.gz
netpbm-mirror-a3e310fee27a93dbe114fe24bd0c2b7e7b60f5c1.tar.xz
netpbm-mirror-a3e310fee27a93dbe114fe24bd0c2b7e7b60f5c1.zip
Release 10.35.38
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@575 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--Makefile.version2
-rw-r--r--converter/ppm/ppmtoarbtxt.c2
-rw-r--r--doc/HISTORY9
-rw-r--r--generator/pbmtext.c23
4 files changed, 21 insertions, 15 deletions
diff --git a/Makefile.version b/Makefile.version
index e637c554..864e0042 100644
--- a/Makefile.version
+++ b/Makefile.version
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 35
-NETPBM_POINT_RELEASE = 37
+NETPBM_POINT_RELEASE = 38
diff --git a/converter/ppm/ppmtoarbtxt.c b/converter/ppm/ppmtoarbtxt.c
index 774a47c4..fe466ea5 100644
--- a/converter/ppm/ppmtoarbtxt.c
+++ b/converter/ppm/ppmtoarbtxt.c
@@ -276,7 +276,7 @@ SKL_OBJ **skl;
    objlen = 0;
    for (;;)   /* Read replacement string up to ')' */
    {
-     if (objlen == sizeof (objstr)) break; /* ')' not found */
+     if (objlen == sizeof (objstr)-1) break; /* ')' not found */
      if ((chr = getc (sklfile)) == EOF) break;
      if (chr == meta3) break;
      objstr[objlen++] = chr;
diff --git a/doc/HISTORY b/doc/HISTORY
index 1247e811..43e80d45 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -3,6 +3,15 @@ Netpbm.
 
 CHANGE HISTORY 
 --------------
+
+08.02.01 BJH  Release 10.35.38
+
+              ppmtoarbtxt: fix array overflow.
+
+              pbmtext: fail cleanly if input line is > 5000 characters.
+
+              pbmtext: fix negative -space .
+
 08.01.15 BJH  Release 10.35.37
 
               Fix fast endianness stuff for 64 bit LE; bypass a compiler
diff --git a/generator/pbmtext.c b/generator/pbmtext.c
index 6706598f..0614657b 100644
--- a/generator/pbmtext.c
+++ b/generator/pbmtext.c
@@ -242,10 +242,8 @@ get_line_dimensions(const char line[], const struct font * const font_p,
                 int full_pixels;  /* integer part of accumulated_ics */
                 accumulated_ics += intercharacter_space;
                 full_pixels = (int) accumulated_ics;
-                if (full_pixels > 0) {
-                    *bwid_p += full_pixels;
-                    accumulated_ics -= full_pixels;
-                }
+                *bwid_p += full_pixels;
+                accumulated_ics -= full_pixels;
             }
             lastGlyphP = glyphP;
             *bwid_p += glyphP->xadd;
@@ -444,13 +442,11 @@ placeCharacterInOutput(char                      const lastch,
                     cursorP->widthSoFar += fontP->glyph[glyphIndex]->x;
             } else {
                 /* handle extra intercharacter space (-space option) */
-                unsigned int fullPixels;  /* integer part of accumulatedIcs */
+                int fullPixels;  /* integer part of accumulatedIcs */
                 cursorP->accumulatedIcs += cursorP->intercharacterSpace;
                 fullPixels = (int) cursorP->accumulatedIcs;
-                if (fullPixels > 0) {
-                    cursorP->widthSoFar += fullPixels;
-                    cursorP->accumulatedIcs -= fullPixels;
-                }
+                cursorP->widthSoFar     += fullPixels;
+                cursorP->accumulatedIcs -= fullPixels;
             }
             cursorP->widthSoFar += fontP->glyph[glyphIndex]->xadd;
         }
@@ -553,10 +549,8 @@ truncateText(struct text   const inputText,
                     int fullPixels;  /* integer part of accumulatedIcs */
                     accumulatedIcs += intercharacterSpace;
                     fullPixels = (int) intercharacterSpace;
-                    if (fullPixels > 0) {
-                        widthSoFar += fullPixels;
-                        accumulatedIcs -= fullPixels;
-                    }
+                    widthSoFar     += fullPixels;
+                    accumulatedIcs -= fullPixels;
                 }
                 widthSoFar += fontP->glyph[lastch]->xadd;
             }
@@ -601,6 +595,9 @@ getText(const char          cmdline_text[],
         
         lineCount = 0;  /* initial value */
         while (fgets(buf, sizeof(buf), stdin) != NULL) {
+            if (strlen(buf) + 1 >= sizeof(buf))
+                pm_error("A line of input text is longer than %u characters."
+                         "Cannot process.", sizeof(buf)-1);
             fix_control_chars(buf, fn);
             if (lineCount >= maxlines) {
                 maxlines *= 2;