From 6cf2bd8716116d0f75d5d37e1c46372b5657c154 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 24 Mar 2010 02:06:41 +0000 Subject: Release 10.35.74 git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@1158 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- Makefile.version | 2 +- analyzer/pnmhistmap.c | 2 +- converter/ppm/ppmtoilbm.c | 10 ++++++++++ doc/HISTORY | 14 ++++++++++++++ generator/pbmpage.c | 3 +++ lib/libpbmfont.c | 12 ++++++++++++ lib/libsystem.c | 6 ++++-- 7 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Makefile.version b/Makefile.version index 03923193..126423fb 100644 --- a/Makefile.version +++ b/Makefile.version @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 35 -NETPBM_POINT_RELEASE = 73 +NETPBM_POINT_RELEASE = 74 diff --git a/analyzer/pnmhistmap.c b/analyzer/pnmhistmap.c index 0b1eeb1f..0e5cf302 100644 --- a/analyzer/pnmhistmap.c +++ b/analyzer/pnmhistmap.c @@ -453,7 +453,7 @@ main (int argc, char ** argv) { else hist_width = range; - hscale = (float)hist_width / range; + hscale = (float)(hist_width-1) / (range-1); if (hscale - 1.0 < epsilon && cmdline.verbose) pm_message("Horizontal scale factor: %g (maxval = %u)", hscale, maxval); diff --git a/converter/ppm/ppmtoilbm.c b/converter/ppm/ppmtoilbm.c index 6c04c9be..7b38dd4d 100644 --- a/converter/ppm/ppmtoilbm.c +++ b/converter/ppm/ppmtoilbm.c @@ -37,6 +37,10 @@ ** - added HAM colormap "rgb4" and "rgb5" (compute with 4/5-bit table) ** - added IFF text chunks ** +** Feb 2010: afu +** Added dimension check to prevent short int from overflowing. +** +** ** TODO: ** - multipalette capability (PCHG chunk) for std and HAM ** @@ -100,6 +104,8 @@ #define DEF_DCOLPLANES 5 #define DEF_IFMODE MODE_DEEP +#define INT16MAX 32767 + static void put_big_short ARGS((short s)); static void put_big_long ARGS((long l)); #define put_byte(b) (void)(putc((unsigned char)(b), stdout)) @@ -1843,6 +1849,10 @@ init_read(fp, colsP, rowsP, maxvalP, formatP, readall) int readall; { ppm_readppminit(fp, colsP, rowsP, maxvalP, formatP); + + if( *rowsP >INT16MAX || *colsP >INT16MAX ) + pm_error ("Input image is too large."); + if( readall ) { int row; diff --git a/doc/HISTORY b/doc/HISTORY index 065efd5c..350c4332 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,20 @@ Netpbm. CHANGE HISTORY -------------- +10.03.24 BJH Release 10.35.74 + + pbmtext: don't crash when font file contains a blank line. + Fail cleanly. + + ppmtoilbm: fix arithmetic overflow with image dimension + represented as 16 bit integer. + + pbmpage: fix garbage output. + + pnmhistmap: Fix crash with -width. Always broken. + + Build: don't fail due to SIGPWR being undefined. + 10.01.23 BJH Release 10.35.73 Restore ability of Pnmconvol convolution matrix to be a diff --git a/generator/pbmpage.c b/generator/pbmpage.c index e10ee6d6..fcf7af42 100644 --- a/generator/pbmpage.c +++ b/generator/pbmpage.c @@ -246,6 +246,9 @@ main(int argc,char** argv) { bitmap.Pwidth = (Width + 7) / 8; bitmap.bitmap = malloc(bitmap.Pwidth * bitmap.Height); + for (x = 0; x < bitmap.Pwidth * bitmap.Height; ++x) + bitmap.bitmap[x] = 0x00; + if (argc>1) TP = atoi(argv[1]); diff --git a/lib/libpbmfont.c b/lib/libpbmfont.c index c7b5a355..54cae478 100644 --- a/lib/libpbmfont.c +++ b/lib/libpbmfont.c @@ -1132,5 +1132,17 @@ int mk_max; s++; } vec[n] = 0; + + /* Caller expects there to be at least one element in vec[], so we + can't return an empty line. More advanced releases of Netpbm + just ignore blank lines. If important, we can fairly easily port + the required code back to this release, by replacing readline() + with a current one, modified somewhat so it compiles here. + + - Bryan 2010.03.23 + */ + if (n < 1) + pm_error("Invalid font file -- contains a blank line"); + return n; } diff --git a/lib/libsystem.c b/lib/libsystem.c index 094480e7..6919bf2c 100644 --- a/lib/libsystem.c +++ b/lib/libsystem.c @@ -216,12 +216,14 @@ signalName(unsigned int const signalClass) { return "SIGWINCH"; case SIGIO: return "SIGIO"; - case SIGPWR: - return "SIGPWR"; case SIGSYS: return "SIGSYS"; default: return "???"; + + /* There are various other signal classes on some systems, but + not defined by POSIX, including: SIGPWR, SIGLOST, SIGINFO + */ } } else if ((int)signalClass >= SIGRTMIN && (int)signalClass <= SIGRTMAX) return "SIGRTxxx"; -- cgit 1.4.1