diff options
Diffstat (limited to 'converter/pbm/pbmtonokia.c')
-rw-r--r-- | converter/pbm/pbmtonokia.c | 17 |
1 files changed, 17 insertions, 0 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); |