From 404092adffe5ad02da2586022b97fe2994831c21 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 25 Mar 2018 17:04:53 +0000 Subject: Release 10.47.68 git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3180 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/pbm/g3topbm.c | 11 +++++++---- converter/pbm/mrftopbm.c | 15 ++++++++++++--- doc/HISTORY | 8 ++++++++ version.mk | 2 +- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/converter/pbm/g3topbm.c b/converter/pbm/g3topbm.c index 7bb95c92..54f1f577 100644 --- a/converter/pbm/g3topbm.c +++ b/converter/pbm/g3topbm.c @@ -740,7 +740,6 @@ main(int argc, char * argv[]) { struct bitStream bitStream; unsigned int rows, cols; unsigned char ** packedBits; - int row; pbm_init(&argc, argv); @@ -766,9 +765,13 @@ main(int argc, char * argv[]) { pm_close(ifP); - pbm_writepbminit(stdout, cols, rows, 0); - for (row = 0; row < rows; ++row) - pbm_writepbmrow_packed(stdout, packedBits[row], cols, 0); + if (cols > 0 && rows > 0) { + unsigned int row; + pbm_writepbminit(stdout, cols, rows, 0); + for (row = 0; row < rows; ++row) + pbm_writepbmrow_packed(stdout, packedBits[row], cols, 0); + } else + pm_error("No image data in input"); pm_close(stdout); diff --git a/converter/pbm/mrftopbm.c b/converter/pbm/mrftopbm.c index 51281028..32f36ef3 100644 --- a/converter/pbm/mrftopbm.c +++ b/converter/pbm/mrftopbm.c @@ -31,7 +31,12 @@ bit_init(void) { static int bit_input(FILE * const in) { if (bitsleft == 0) { - bitbox = fgetc(in); + int rc; + rc = fgetc(in); + if (rc == EOF) + pm_error("Unexpected EOF reading image data."); + + bitbox = rc; bitsleft = 8; } --bitsleft; @@ -133,11 +138,15 @@ readMrfImage(FILE * const ifP, unsigned int w64, h64; unsigned char * image; + unsigned int bytesRead; - fread(buf, 1, 13, ifP); + bytesRead = fread(buf, 1, 13, ifP); + if (bytesRead != 13) + pm_error("Input in not an MRF image. We know this because it is less " + "than 13 bytes, the size of an MRF header"); if (memcmp(buf, "MRF1", 4) != 0) - pm_error("Input is not an mrf image. " + pm_error("Input is not an MRF image. " "We know this because it does not start with 'MRF1'."); if (buf[12] != 0) diff --git a/doc/HISTORY b/doc/HISTORY index 1d9b764a..4142d4a6 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,14 @@ Netpbm. CHANGE HISTORY -------------- +18.03.25 BJH Release 10.47.68 + + g3topbm: Fix bug - produces invalid empty PBM image if input + image is empty. + + mrftopbm: Fix bug - wrong error messages or output when input + invalidly short. + 17.12.30 BJH Release 10.47.67 sldtoppm: fix bug: says AutoCAD slide file isn't an AutoCAD diff --git a/version.mk b/version.mk index 87d5cf9f..1537a017 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 47 -NETPBM_POINT_RELEASE = 67 +NETPBM_POINT_RELEASE = 68 -- cgit 1.4.1