about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--converter/pbm/pbmtonokia.c17
-rw-r--r--doc/HISTORY6
2 files changed, 22 insertions, 1 deletions
diff --git a/converter/pbm/pbmtonokia.c b/converter/pbm/pbmtonokia.c
index 26e60358..ebcd813d 100644
--- a/converter/pbm/pbmtonokia.c
+++ b/converter/pbm/pbmtonokia.c
@@ -153,6 +153,21 @@ freeCmdline(struct cmdlineInfo const cmdline) {
 
 
 static void
+validateSize(unsigned int const cols,
+             unsigned int const rows){
+
+    if (cols > 255)
+        pm_error("This program cannot handle files with more than 255 "
+                 "columns");
+    if (rows > 255)
+        pm_error("This program cannot handle files with more than 255 "
+                 "rows");
+}
+
+
+
+
+static void
 convertToHexNol(bit **       const image,
                 unsigned int const cols,
                 unsigned int const rows,
@@ -456,6 +471,8 @@ main(int    argc,
     bits = pbm_readpbm(ifP, &cols, &rows);
     pm_close(ifP);
 
+    validateSize(cols, rows);
+
     switch (cmdline.outputFormat) {
     case FMT_HEX_NGG:
         convertToHexNgg(bits, cols, rows, stdout);
diff --git a/doc/HISTORY b/doc/HISTORY
index cb856061..45c9b1f0 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,7 +6,11 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.40.00
 
-              pnmtopalm: fix typo in error message.
+              pbmtonokia: fail if input is > 255 x 255.  Thanks Paul Bolle
+              <pebolle@tiscali.nl>.
+
+              pnmtopalm: fix typo in error message.  Thanks Paul Bolle
+              <pebolle@tiscali.nl>.
 
               pnmtops: fix crash when program attempts to write 12 bits per
               sample Postscript.  It doesn't really know how to do that, so