diff options
-rw-r--r-- | converter/other/bmptopnm.c | 8 | ||||
-rw-r--r-- | converter/other/jpeg2000/Makefile | 2 | ||||
-rw-r--r-- | converter/other/pnmtojpeg.c | 4 | ||||
-rw-r--r-- | doc/HISTORY | 32 | ||||
-rw-r--r-- | generator/pamgauss.c | 3 | ||||
-rw-r--r-- | lib/Makefile | 14 | ||||
-rw-r--r-- | lib/libsystem.c | 24 | ||||
-rw-r--r-- | lib/libsystem_dummy.c | 16 | ||||
-rw-r--r-- | version.mk | 2 |
9 files changed, 84 insertions, 21 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c index 88f8ccce..3d108bf7 100644 --- a/converter/other/bmptopnm.c +++ b/converter/other/bmptopnm.c @@ -372,10 +372,16 @@ readWindowsBasic40ByteInfoHeader(FILE * const ifP, -----------------------------------------------------------------------------*/ int colorsimportant; /* ColorsImportant value from header */ int colorsused; /* ColorsUsed value from header */ + long colsField; headerP->class = C_WIN; - headerP->cols = GetLong(ifP); + colsField = GetLong(ifP); + + if (colsField <= 0) + pm_error("Invalid BMP file: says width is %ld", colsField); + + headerP->cols = (unsigned long)colsField; { long const cy = GetLong(ifP); if (cy == 0) diff --git a/converter/other/jpeg2000/Makefile b/converter/other/jpeg2000/Makefile index f4fee87f..f2e3b4a1 100644 --- a/converter/other/jpeg2000/Makefile +++ b/converter/other/jpeg2000/Makefile @@ -57,7 +57,7 @@ all: $(BINARIES) include $(SRCDIR)/common.mk -LIBOPTS = $(shell $(LIBOPT) $(NETPBMLIB) $(JASPERLIB_USE)) +LIBOPTS = $(shell $(LIBOPT) $(JASPERLIB_USE) $(NETPBMLIB)) $(BINARIES): %: %.o $(JASPERLIB_DEP) $(NETPBMLIB) $(LIBOPT) $(LD) -o $@ $< \ diff --git a/converter/other/pnmtojpeg.c b/converter/other/pnmtojpeg.c index 198aa156..b33b36b3 100644 --- a/converter/other/pnmtojpeg.c +++ b/converter/other/pnmtojpeg.c @@ -230,7 +230,7 @@ parseCommandLine(const int argc, char ** argv, char ** argv_parse; /* argv, except we modify it as we parse */ - MALLOCARRAY(argv_parse, argc); + MALLOCARRAY(argv_parse, argc + 1); /* +1 for the terminating null ptr */ option_def_index = 0; /* incremented by OPTENTRY */ OPTENT3(0, "verbose", OPT_FLAG, NULL, &cmdlineP->verbose, 0); @@ -273,7 +273,7 @@ parseCommandLine(const int argc, char ** argv, /* Make private copy of arguments for optParseOptions to corrupt */ argc_parse = argc; - for (i=0; i < argc; i++) argv_parse[i] = argv[i]; + for (i=0; i < argc+1; i++) argv_parse[i] = argv[i]; opt.opt_table = option_def; opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ diff --git a/doc/HISTORY b/doc/HISTORY index 40e81300..5d07cde1 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,13 +4,43 @@ Netpbm. CHANGE HISTORY -------------- +17.06.28 BJH Release 10.47.65 + + pamgauss: Fix skewed output with even dimension. Always broken + (Pamgauss was added in Netpbm 10.23 (July 2004). + + bmptopnm: fix crash when input is a Windows BMP with negative + number for width. Always broken. (bmptopnm was new, as + bmptoppm, in original Netpbm, 1992). + + pnmtojpeg: fix array bounds violation in argument list. Always + broken (pnmtojpeg was new to Netpbm in Netpbm 8.2 (March 2000). + + Build: correct link order in Jpeg2000 converter builds to + correct undefined symbol reference at link time. + + libnetpbm: fix bug: pm_system_XXX closes Standard Input if you + supply a Standard Output accepter but not a Standard Input + feeder. Broken since Netpbm 10.40 (September 2007). + + Windows: fix bug: pm_system_lp() and pm_system_vp() fail + silently instead of with a clear error message in an environment + that does not provide Unix process management. Always broken. + (pm_system_lp and pm_system_vp were new in Netpbm 10.40 + (September 2007), but wouldn't even compile until Netpbm 10.42 + (March 2008)). + + Build: don't try to build standardppmdfont.c if it already + exists (so don't require ppmdcfont to exist). Broken around + Netpbm 10.35 (2006). + 17.03.28 BJH Release 10.47.64 tifftonm: Fix incorrect PBM output with two-color paletted TIFF image. Broken in primordial Netpbm, ca 1990. giftopnm: Fix buffer overflow/crash with invalid GIF input. - Broken since primorial Netpbm. + Broken since primordial Netpbm. bmptopnm: Fix buffer overflow/crash with negative height or width in OS/2 BMP. Broken since primordial Netpbm. diff --git a/generator/pamgauss.c b/generator/pamgauss.c index 2b715467..1fb47af6 100644 --- a/generator/pamgauss.c +++ b/generator/pamgauss.c @@ -111,7 +111,8 @@ distFromCenter(struct pam * const pamP, int const col, int const row) { - return sqrt(SQR(col - pamP->width/2) + SQR(row - pamP->height/2)); + return sqrt(SQR(0.5 + col - (double)pamP->width/2) + + SQR(0.5 + row - (double)pamP->height/2)); } diff --git a/lib/Makefile b/lib/Makefile index 67fac5b2..0738e5cb 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -183,12 +183,14 @@ libnetpbm.$(STATICLIBSUFFIX): $(LIBOBJECTS) $(LIBOBJECTS_X) -$(RANLIB) $@ endif - -# To avoid major hassles with having ppmdcfont available here, we just -# ship a pre-made standardppmfont.c, so this rule will not normally be -# used. -standardppmdfont.c:standard.ppmdfont - ppmdcfont <$< >$@ +# To avoid major hassles with having ppmdcfont available here, we just ship a +# pre-made standardppmfont.c, so this rule will not normally be used. Though +# standardppmdfont.c depends upon standard.ppmdfont, we don't declare that +# here because when the user creates the source tree, the modification time of +# standard.ppmdfont may end up later than that of standardppmdfont.c, which +# would make the build want to rebuild it. +standardppmdfont.c: + ppmdcfont <standard.ppmdfont >$@ # Note that we create a new compile.h only for the first make after a # make clean. This is good enough. We used to do stamp-date for diff --git a/lib/libsystem.c b/lib/libsystem.c index 92495fe5..1c407ce4 100644 --- a/lib/libsystem.c +++ b/lib/libsystem.c @@ -381,13 +381,22 @@ pm_system_vp(const char * const progName, */ int progStdinFd; + /* File descriptor that the processor program will get as Standard + Input + */ + bool weCreatedStdinFd; + /* This program created (opened) file descriptor 'progStdinFd', + as opposed to inheriting it. + */ pid_t feederPid; pid_t processorPid; - if (stdinFeeder) + if (stdinFeeder) { createPipeFeeder(stdinFeeder, feederParm, &progStdinFd, &feederPid); - else { + weCreatedStdinFd = true; + } else { progStdinFd = STDIN; + weCreatedStdinFd = false; feederPid = 0; } @@ -400,10 +409,6 @@ pm_system_vp(const char * const progName, spawnProcessor(progName, argArray, progStdinFd, &progStdoutFd, &processorPid); - /* The child process has cloned our 'progStdinFd'; we have no - more use for our copy. - */ - close(progStdinFd); /* Dispose of the stdout from that child */ (*stdoutAccepter)(progStdoutFd, accepterParm); close(progStdoutFd); @@ -414,6 +419,13 @@ pm_system_vp(const char * const progName, spawnProcessor(progName, argArray, progStdinFd, NULL, &processorPid); } + if (weCreatedStdinFd) { + /* The child process has cloned our 'progStdinFd'; we have no + more use for our copy. + */ + close(progStdinFd); + } + cleanupProcessorProcess(processorPid); if (feederPid) diff --git a/lib/libsystem_dummy.c b/lib/libsystem_dummy.c index 2787ce67..db26ba7a 100644 --- a/lib/libsystem_dummy.c +++ b/lib/libsystem_dummy.c @@ -21,6 +21,12 @@ pm_system_vp(const char * const progName, void * const feederParm, void stdoutAccepter(int, void *), void * const accepterParm) { + + pm_error("This program wants to run another program using pm_system_vp() " + "in the libnetpbm library, but libnetpbm was built without " + "the pm_system_vp() facility -- probably because this system " + "doesn't have the process management facilities pm_system() " + "requires."); } void @@ -30,6 +36,12 @@ pm_system_lp(const char * const progName, void stdoutAccepter(int, void *), void * const accepterParm, ...) { + + pm_error("This program wants to run another program using pm_system_lp() " + "in the libnetpbm library, but libnetpbm was built without " + "the pm_system_lp() facility -- probably because this system " + "doesn't have the process management facilities pm_system() " + "requires."); } void @@ -39,8 +51,8 @@ pm_system(void stdinFeeder(int, void *), void * const accepterParm, const char * const shellCommand) { - pm_error("This program wants to run another program using pm_system() in " - "the libnetpbm library, but libnetpbm was built without " + pm_error("This program wants to run another program using pm_system() " + "in the libnetpbm library, but libnetpbm was built without " "the pm_system() facility -- probably because this system " "doesn't have the process management facilities pm_system() " "requires."); diff --git a/version.mk b/version.mk index d9504c0e..60ee9b24 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 47 -NETPBM_POINT_RELEASE = 64 +NETPBM_POINT_RELEASE = 65 |