From 83e6e6b52c4c6854c7b611bfc74b12cd60d18263 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Tue, 28 Aug 2007 03:24:24 +0000 Subject: Add 255 x 255 size limitation git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@389 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/pbm/pbmtonokia.c | 17 +++++++++++++++++ doc/HISTORY | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) 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 @@ -152,6 +152,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, @@ -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 + . + + pnmtopalm: fix typo in error message. Thanks Paul Bolle + . pnmtops: fix crash when program attempts to write 12 bits per sample Postscript. It doesn't really know how to do that, so -- cgit 1.4.1