about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2007-08-28 03:24:24 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2007-08-28 03:24:24 +0000
commit83e6e6b52c4c6854c7b611bfc74b12cd60d18263 (patch)
treeb0cd68473f902810f19f20e3f501539ef4db9e2f
parent67c5ea8b97719381fcfe399d9e31e79014253b96 (diff)
downloadnetpbm-mirror-83e6e6b52c4c6854c7b611bfc74b12cd60d18263.tar.gz
netpbm-mirror-83e6e6b52c4c6854c7b611bfc74b12cd60d18263.tar.xz
netpbm-mirror-83e6e6b52c4c6854c7b611bfc74b12cd60d18263.zip
Add 255 x 255 size limitation
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@389 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-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