about summary refs log tree commit diff
path: root/converter/pbm/ybmtopbm.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter/pbm/ybmtopbm.c')
-rw-r--r--converter/pbm/ybmtopbm.c5
1 files changed, 5 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);