about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-20 02:12:59 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-20 02:12:59 +0000
commit731c59b6e76abe8c872993ecb845f8c23599188a (patch)
tree3acb5c9b55c81cca9b3bb29baad5e93a3b4ab56b
parent32b7a323a63837c399e402f60657ec88431dc301 (diff)
downloadnetpbm-mirror-731c59b6e76abe8c872993ecb845f8c23599188a.tar.gz
netpbm-mirror-731c59b6e76abe8c872993ecb845f8c23599188a.tar.xz
netpbm-mirror-731c59b6e76abe8c872993ecb845f8c23599188a.zip
Fix arithmetic overlow
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4670 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/pbm/ybmtopbm.c5
-rw-r--r--doc/HISTORY4
2 files changed, 9 insertions, 0 deletions
diff --git a/converter/pbm/ybmtopbm.c b/converter/pbm/ybmtopbm.c
index 36f2dee7..78eb79f2 100644
--- a/converter/pbm/ybmtopbm.c
+++ b/converter/pbm/ybmtopbm.c
@@ -10,6 +10,8 @@
 ** implied warranty.
 */
 
+#include <limits.h>
+
 #include "pm.h"
 #include "pbm.h"
 #include "bitreverse.h"
@@ -80,6 +82,9 @@ main(int argc, const char * argv[]) {
     getinit(ifP, &cols, &rows, &depth);
     if (depth != 1)
         pm_error("YBM file has depth of %u, must be 1", (unsigned int) depth);
+    if (cols > INT_MAX - 15)
+        pm_error("YBM file has uncomputably large width %d", cols);
+
 
     pbm_writepbminit(stdout, cols, rows, 0);
 
diff --git a/doc/HISTORY b/doc/HISTORY
index 825ba0da..af31c32b 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -66,6 +66,10 @@ not yet  BJH  Release 11.04.00
 
               tifftopnm: Fix incorrect output with really wide/deep rows.
 
+              thinkjettopbm: Fix incorrect output with really wide rows
+
+              ybmtopbm: Fix incorrect output with really wide rows
+
               library: add check of maxval for computable size.
 
               Build: Include LDFLAGS in link of shared library.