about summary refs log tree commit diff
path: root/converter
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-07 15:41:07 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-07 15:41:07 +0000
commitf9aeba86b7572e433c798f9cb2210e014077d1b9 (patch)
tree4ed5f2dbb079dac28d64268db59bb4875c40e9b0 /converter
parente8bfe183b5e504f0f30691484e9d73ea42113363 (diff)
downloadnetpbm-mirror-f9aeba86b7572e433c798f9cb2210e014077d1b9.tar.gz
netpbm-mirror-f9aeba86b7572e433c798f9cb2210e014077d1b9.tar.xz
netpbm-mirror-f9aeba86b7572e433c798f9cb2210e014077d1b9.zip
Release 10.78.05
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2989 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r--converter/other/bmptopnm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index 54868364..49e730fd 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -384,10 +384,17 @@ readWindowsBasic40ByteInfoHeader(FILE *                 const ifP,
 -----------------------------------------------------------------------------*/
     int colorsused;        /* ColorsUsed value from header */
     unsigned short planesField, bitCountField;
+    int32_t colsField;
 
-    headerP->cols = GetLong(ifP);
-    if (headerP->cols == 0)
+    pm_readlittlelong2(ifP, &colsField);
+
+    if (colsField == 0)
         pm_error("Invalid BMP file: says width is zero");
+    else if (colsField < 0)
+        pm_error("Invalid BMP file: says width is negative (%d)", colsField);
+    else
+        headerP->cols = (unsigned int)colsField;
+
     {
         long const cy = GetLong(ifP);