about summary refs log tree commit diff
path: root/converter/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2010-12-10 18:19:40 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2010-12-10 18:19:40 +0000
commit9d8461b2012adb25ba0b10deff31dc766f6ea8f2 (patch)
tree97434a8dfcc90dc9d7cfe97f3d08a0f6b3395e35 /converter/other
parentc1504a8ffa4694779448393e5781cb182610c486 (diff)
downloadnetpbm-mirror-9d8461b2012adb25ba0b10deff31dc766f6ea8f2.tar.gz
netpbm-mirror-9d8461b2012adb25ba0b10deff31dc766f6ea8f2.tar.xz
netpbm-mirror-9d8461b2012adb25ba0b10deff31dc766f6ea8f2.zip
Release 10.35.78
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@1375 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rw-r--r--converter/other/bmptopnm.c17
-rw-r--r--converter/other/pnmtopng.c2
2 files changed, 12 insertions, 7 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index 4d29e4d3..e1bd1403 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -84,8 +84,11 @@ struct bmpInfoHeader {
            described by the "mask" values in the header, rather than
            fixed formats.
         */
-    int cmapsize;
-        /* Size in bytes of the colormap (palette) in the BMP file */
+    unsigned int cmapsize;
+        /* Size in bytes of the colormap (palette) in the BMP file.
+
+           Zero means there is no colormap.
+        */
     unsigned int imageSize;
         /* Size in bytes of the image data.  We only reference this 
            when the image is compressed. */    
@@ -320,6 +323,8 @@ readWindowsBasic40ByteInfoHeader(FILE *                 const ifP,
     headerP->cols = GetLong(ifP);
     {
         long const cy = GetLong(ifP);
+        if (cy == 0)
+            pm_error("Invalid BMP file: says height is zero");
         if (cy < 0) {
             headerP->rowOrder = TOPDOWN;
             headerP->rows = - cy;
@@ -360,7 +365,7 @@ readWindowsBasic40ByteInfoHeader(FILE *                 const ifP,
     GetLong(ifP);   /* YpixelsPerMeter */
     colorsused = GetLong(ifP);   /* ColorsUsed */
     /* See comments in bmp.h for info about the definition of the following
-       word and its relationship to the color map size (*pcmapsize).
+       word and its relationship to the color map size (headerP->cmapsize).
     */
     colorsimportant = GetLong(ifP);  /* ColorsImportant */
 
@@ -584,7 +589,7 @@ static void
 BMPreadcolormap(FILE *         const ifP, 
                 int            const class, 
                 xel **         const colormapP, 
-                int            const cmapsize,
+                unsigned int   const cmapsize,
                 unsigned int * const bytesReadP) {
 /*----------------------------------------------------------------------------
    Read the color map from the present position in the input BMP file
@@ -599,7 +604,7 @@ BMPreadcolormap(FILE *         const ifP,
    'class' is the class of BMP image - Windows or OS/2.
 -----------------------------------------------------------------------------*/
 
-    int i;
+    unsigned int i;
 
     xel * colormap;
     unsigned int bytesRead;
@@ -1139,7 +1144,7 @@ reportHeader(struct bmpInfoHeader const header,
                header.compression == COMP_JPEG ? "JPEG (not supported)" :
                header.compression == COMP_PNG ? "PNG (not supported)" :
                "???");                
-    pm_message("  Colors in color map: %d", header.cmapsize);
+    pm_message("  Colors in color map: %u", header.cmapsize);
 }        
 
 
diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c
index ce1fe4f6..065f5195 100644
--- a/converter/other/pnmtopng.c
+++ b/converter/other/pnmtopng.c
@@ -72,7 +72,7 @@
 #if PNG_LIBPNG_VER >= 10400
 #error Your PNG library (<png.h>) is incompatible with this Netpbm source code.
 #error You need either an older PNG library (older than 1.4)
-#error newer Netpbm source code (at least 10.48)
+#error newer Netpbm source code (at least 10.47.04)
 #endif