diff --git a/.gitignore b/.gitignore
index 34e7179..f4510f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,32 @@
/netpbm-10.61.02.tar.xz
/netpbm-10.66.02.tar.xz
+/netpbm-10.71.02.tar.xz
+/netpbm-10.75.99.tar.xz
+/netpbm-10.76.00.tar.xz
+/netpbm-10.77.00.tar.xz
+/netpbm-10.78.00.tar.xz
+/netpbm-10.79.00.tar.xz
+/netpbm-10.80.00.tar.xz
+/netpbm-10.81.00.tar.xz
+/netpbm-10.82.00.tar.xz
+/netpbm-10.83.01.tar.xz
+/netpbm-10.84.03.tar.xz
+/netpbm-10.86.00.tar.xz
+/netpbm-10.87.00.tar.xz
+/netpbm-10.88.00.tar.xz
+/netpbm-10.89.00.tar.xz
+/netpbm-10.90.00.tar.xz
+/netpbm-10.92.00.tar.xz
+/netpbm-10.93.00.tar.xz
+/netpbm-10.94.05.tar.xz
+/netpbm-10.95.00.tar.xz
+/netpbm-10.96.00.tar.xz
+/netpbm-10.97.00.tar.xz
+/netpbm-10.99.00.tar.xz
+/netpbm-11.00.00.tar.xz
+/netpbm-11.01.00.tar.xz
+/netpbm-11.02.00.tar.xz
+/netpbm-11.09.00.tar.xz
+/netpbm-11.10.00.tar.xz
+/netpbm-11.12.00.tar.xz
+/netpbm-11.13.00.tar.xz
diff --git a/fix.patch b/fix.patch
new file mode 100644
index 0000000..b3c3cb9
--- /dev/null
+++ b/fix.patch
@@ -0,0 +1,1336 @@
+diff --git a/analyzer/pgmtexture.c b/analyzer/pgmtexture.c
+index c69643e..2e09dde 100644
+--- a/analyzer/pgmtexture.c
++++ b/analyzer/pgmtexture.c
+@@ -54,6 +54,7 @@ vector(unsigned int const nl,
+
+ assert(nh >= nl);
+
++ overflow_add(nh - nl, 1);
+ MALLOCARRAY(v, (unsigned) (nh - nl + 1));
+
+ if (v == NULL)
+@@ -85,6 +86,7 @@ matrix (unsigned int const nrl,
+ assert(nrh >= nrl);
+
+ /* allocate pointers to rows */
++ overflow_add(nrh - nrl, 1);
+ MALLOCARRAY(m, (unsigned) (nrh - nrl + 1));
+ if (m == NULL)
+ pm_error("Unable to allocate memory for a matrix.");
+@@ -93,6 +95,7 @@ matrix (unsigned int const nrl,
+
+ assert (nch >= ncl);
+
++ overflow_add(nch - ncl, 1);
+ /* allocate rows and set pointers to them */
+ for (i = nrl; i <= nrh; ++i) {
+ MALLOCARRAY(m[i], (unsigned) (nch - ncl + 1));
+diff --git a/converter/other/gemtopnm.c b/converter/other/gemtopnm.c
+index 6bbfcc0..24199cb 100644
+--- a/converter/other/gemtopnm.c
++++ b/converter/other/gemtopnm.c
+@@ -106,6 +106,7 @@ main(argc, argv)
+
+ pnm_writepnminit( stdout, cols, rows, MAXVAL, type, 0 );
+
++ overflow_add(cols, padright);
+ {
+ /* allocate input row data structure */
+ int plane;
+diff --git a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c
+index 98552c0..311298c 100644
+--- a/converter/other/jpegtopnm.c
++++ b/converter/other/jpegtopnm.c
+@@ -862,6 +862,8 @@ convertImage(FILE * const ofP,
+ /* Calculate output image dimensions so we can allocate space */
+ jpeg_calc_output_dimensions(cinfoP);
+
++ overflow2(cinfoP->output_width, cinfoP->output_components);
++
+ /* Start decompressor */
+ jpeg_start_decompress(cinfoP);
+
+diff --git a/converter/other/pbmtopgm.c b/converter/other/pbmtopgm.c
+index 817fb5b..8baaa57 100644
+--- a/converter/other/pbmtopgm.c
++++ b/converter/other/pbmtopgm.c
+@@ -60,6 +60,7 @@ main(int argc, char *argv[]) {
+
+
+ outrow = pgm_allocrow(cols) ;
++ overflow2(width, height);
+ maxval = MIN(PGM_OVERALLMAXVAL, width*height);
+ pgm_writepgminit(stdout, cols, rows, maxval, 0) ;
+
+diff --git a/converter/other/pnmtoddif.c b/converter/other/pnmtoddif.c
+index b7b942b..52be0e4 100644
+--- a/converter/other/pnmtoddif.c
++++ b/converter/other/pnmtoddif.c
+@@ -629,6 +629,7 @@ main(int argc, char *argv[]) {
+ switch (PNM_FORMAT_TYPE(format)) {
+ case PBM_TYPE:
+ ip.bits_per_pixel = 1;
++ overflow_add(cols, 7);
+ ip.bytes_per_line = (cols + 7) / 8;
+ ip.spectral = 2;
+ ip.components = 1;
+@@ -644,6 +645,7 @@ main(int argc, char *argv[]) {
+ ip.polarity = 2;
+ break;
+ case PPM_TYPE:
++ overflow2(cols, 3);
+ ip.bytes_per_line = 3 * cols;
+ ip.bits_per_pixel = 24;
+ ip.spectral = 5;
+diff --git a/converter/other/pnmtojpeg.c b/converter/other/pnmtojpeg.c
+index e345831..39038f8 100644
+--- a/converter/other/pnmtojpeg.c
++++ b/converter/other/pnmtojpeg.c
+@@ -605,8 +605,10 @@ read_scan_script(j_compress_ptr const cinfo,
+ data, but if you want to compress multiple images you'd
+ want JPOOL_PERMANENT.
+ */
++ overflow2(nscans, sizeof(jpeg_scan_info));
+ const unsigned int scan_info_size = nscans * sizeof(jpeg_scan_info);
+- jpeg_scan_info * const scan_info =
++ const jpeg_scan_info * scan_info;
++ scan_info =
+ (jpeg_scan_info *)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ scan_info_size);
+@@ -938,6 +940,8 @@ compute_rescaling_array(JSAMPLE ** const rescale_p, const pixval maxval,
+ const long half_maxval = maxval / 2;
+ long val;
+
++ overflow_add(maxval, 1);
++ overflow2(maxval+1, sizeof(JSAMPLE));
+ *rescale_p = (JSAMPLE *)
+ (cinfo.mem->alloc_small) ((j_common_ptr) &cinfo, JPOOL_IMAGE,
+ (size_t) (((long) maxval + 1L) *
+@@ -1016,6 +1020,7 @@ convert_scanlines(struct jpeg_compress_struct * const cinfo_p,
+ */
+
+ /* Allocate the libpnm output and compressor input buffers */
++ overflow2(cinfo_p->image_width, cinfo_p->input_components);
+ buffer = (*cinfo_p->mem->alloc_sarray)
+ ((j_common_ptr) cinfo_p, JPOOL_IMAGE,
+ (unsigned int) cinfo_p->image_width * cinfo_p->input_components,
+diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c
+index 45d856d..5b04eeb 100644
+--- a/converter/other/pnmtops.c
++++ b/converter/other/pnmtops.c
+@@ -294,17 +294,21 @@ parseCommandLine(int argc, const char ** argv,
+ validateCompDimension(width, 72, "-width value");
+ validateCompDimension(height, 72, "-height value");
+
++ overflow2(width, 72);
+ cmdlineP->width = width * 72;
++ overflow2(height, 72);
+ cmdlineP->height = height * 72;
+
+ if (imagewidthSpec) {
+ validateCompDimension(imagewidth, 72, "-imagewidth value");
++ overflow2(imagewidth, 72);
+ cmdlineP->imagewidth = imagewidth * 72;
+ }
+ else
+ cmdlineP->imagewidth = 0;
+ if (imageheightSpec) {
+- validateCompDimension(imagewidth, 72, "-imageheight value");
++ validateCompDimension(imageheight, 72, "-imageheight value");
++ overflow2(imageheight, 72);
+ cmdlineP->imageheight = imageheight * 72;
+ }
+ else
+diff --git a/converter/other/rletopnm.c b/converter/other/rletopnm.c
+index 97f271d..72b63d3 100644
+--- a/converter/other/rletopnm.c
++++ b/converter/other/rletopnm.c
+@@ -19,6 +19,8 @@
+ * If you modify this software, you should include a notice giving the
+ * name of the person performing the modification, the date of modification,
+ * and the reason for such modification.
++ *
++ * 2002-12-19: Fix maths wrapping bugs. Alan Cox The frame options are additive. All the parts of the image
@@ -101,24 +105,25 @@ diff -up netpbm-10.47.12/userguide/pamperspective.html.docfix netpbm-10.47.12/us
--include (or their defaults) are in the visible part. The
visible part is the smallest possible rectangle that contains the
parts specified those three ways.
-diff -up netpbm-10.47.12/userguide/pbmtoepson.html.docfix netpbm-10.47.12/userguide/pbmtoepson.html
---- netpbm-10.47.12/userguide/pbmtoepson.html.docfix 2010-04-27 15:48:09.000000000 +0200
-+++ netpbm-10.47.12/userguide/pbmtoepson.html 2010-05-03 14:34:03.571141020 +0200
-@@ -18,7 +18,7 @@ pbmtoepson - convert a PBM image into Ep
+diff --git a/userguide/pbmtoepson.html b/userguide/pbmtoepson.html
+index baacf7b..e74a7fe 100644
+--- a/userguide/pbmtoepson.html
++++ b/userguide/pbmtoepson.html
+@@ -16,7 +16,7 @@ pbmtoepson - convert a PBM image into Epson printer graphics
[-dpi=n]
- [-protocol={escp9|escp}]
+ [-protocol={escp9|escp}]
[-adjacent]
-[-nonadjacent]
+[-noadjacent]
- [pbmfile]
+ [pbmfile]
-@@ -74,7 +74,7 @@ print density for you consistent with yo
+@@ -75,7 +75,7 @@ print density for you consistent with your other options.
This option was new in Netpbm 10.23 (July 2004).
Updated: 07 February 2010 avstopam - convert an AVS X image to a Netpbm image
+@@ -16,40 +16,40 @@ Updated: 07 February 2010
- This program is part of Netpbm.
++ This program is part of Netpbm. avstopam reads a Stardent AVS X image as input and produces a Netpbm
+-image as output.
++image as output. avsfile is the input file, which defaults to Standard Input.
+-Output is always on Standard Output.
++Output is always on Standard Output. There are no command line options defined specifically
+ for avstopam, but it recognizes the options common to all
+ programs based on libnetpbm (See
+-Common Options.)
++Common Options.) Copyright © 2010 Scott Pakin,
+-scott+pbm@pakin.org
++scott+pbm@pakin.org This page, part of the Netpbm user's guide,
describes FAX formats in relation to Netpbm facilities.
-
-+ The ITU (formerly CCITT) publishes standards for operation of fax machines
(the idea is to provide a way to be sure that a fax machine is able to receive
a fax sent by another). These standards incidentally specify graphics file
-diff -up netpbm-10.59.03/userguide/pampaintspill.html.manfix netpbm-10.59.03/userguide/pampaintspill.html
---- netpbm-10.59.03/userguide/pampaintspill.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/pampaintspill.html 2012-09-25 10:47:22.757174803 +0200
-@@ -1,8 +1,7 @@
-
--
-+
- The Libnetpbm Netpbm Image
+-Processing Manual describes the the libnetpbm functions for
++Processing Manual describes the libnetpbm functions for
+ processing image data.
+
+ The Libnetpbm Utility Manual
+diff -urNp a/userguide/pamfunc.html b/userguide/pamfunc.html
+--- a/userguide/pamfunc.html 2025-02-04 10:47:27.823451565 +0100
++++ b/userguide/pamfunc.html 2025-02-04 17:52:19.661114878 +0100
+@@ -60,7 +60,7 @@ output image.
+ and bit string (such as and with 01001000). For the arithmetic functions, the
+ function arguments and results are the fraction that a sample is of the
+ maxval, i.e. normal interpretation of PAM tuples. But for the bit string
+-functions, the value is the the bit string whose value as a binary cipher is
++functions, the value is the bit string whose value as a binary cipher is
+ the sample value, and the maxval indicates the width of the bit string.
+
+ pammixmulti - blend together multiple PAM images
++ pammixmulti - blend together multiple PAM imagesescp2topbm
--Created: 1 August 2003
-+Updated: 1 August 2003
-
- Table Of Contents
+ avstopam
+-Updated: 07 February 2010
+-
+-Table Of Contents
++NAME
-+NAME
- escp2topbm - convert an ESC/P2 printer file to a PBM image
+ SYNOPSIS
-diff -up netpbm-10.59.03/userguide/faxformat.html.manfix netpbm-10.59.03/userguide/faxformat.html
---- netpbm-10.59.03/userguide/faxformat.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/faxformat.html 2012-09-25 10:47:22.756174816 +0200
-@@ -5,10 +5,12 @@
+ DESCRIPTION
+
+-OPTIONS
+
+ AUTHOR
+
+ SEE ALSO
+
+-
+
+
+
+ Table Of Contents
+
+-
+
+
+diff -urNp a/userguide/faxformat.html b/userguide/faxformat.html
+--- a/userguide/faxformat.html 2025-02-04 10:47:27.824451560 +0100
++++ b/userguide/faxformat.html 2025-02-04 17:50:41.300631089 +0100
+@@ -5,10 +5,11 @@
Updated: 03 December 2008
-
+
-+SYNOPSIS
++SYNOPSIS
DESCRIPTION
+-
++DESCRIPTION
Reference
+ Arithmetic functions
+diff -urNp a/userguide/pammixmulti.html b/userguide/pammixmulti.html
+--- a/userguide/pammixmulti.html 2025-02-04 10:47:27.820451577 +0100
++++ b/userguide/pammixmulti.html 2025-02-04 17:56:58.538651212 +0100
+@@ -7,8 +7,8 @@ Updated: 18 December 2024
+ Table Of Contents
+
+
+-NAME
+-NAME
++SYNOPSIS
+@@ -17,19 +17,19 @@ Updated: 18 December 2024
+ [-maskfile=filename]
+ [-stdev=number]
+ [-randomseed integer]
+- filename ...
++ filename ...
Minimum unique abbreviation of an option is acceptable. You can use double + hyphen instead of a single hyphen to denote options. You can use white + space in place of the equals sign to separate an option name from its +-value. ++value.
+ + +This file is part of Netpbm. ++
This file is part of Netpbm.
+ +pammixmulti mixes two or more images to produce a new image. The +-program provides multiple ways to interpret "mix." ++program provides multiple ways to interpret "mix."
+ + +In addition to the options common to all programs based on libnetpbm + (most notably -quiet, see + Common Options), pammixmulti recognizes the following +-command line options: ++command line options:
+ +mask, each pixel in the output is
+ produced by a weighted average of the corresponding pixels from all
+ the input images based on the grayscale level of an additional mask
+-image.
+--alpha-weighted was new in Netpbm 11.09 (December 2024). ++image.
++-alpha-weighted was new in Netpbm 11.09 (December 2024).
+ + +Use this to ensure you get the same image on separate invocations. ++
Use this to ensure you get the same image on separate invocations.
+ +You supply the names of the files to mix as non-option arguments. ++
You supply the names of the files to mix as non-option arguments.
+ + +Average a bunch of PPM images to produce a new PAM image: ++
Average a bunch of PPM images to produce a new PAM image:
+
+ pammixmulti input*.ppm >output.ppm
+
+
+ Mix these same images by taking each pixel from a randomly selected input +-image: ++image:
+ +
+ pammixmulti -blend=random input*.ppm >output.ppm
+
+
+ Use a mask image to control the fading among input images on a +-pixel-by-pixel basis: ++pixel-by-pixel basis:
+ +
+ pammixmulti -blend=mask -maskfile=mask.pgm >output.pam \
+ one.pam two.pam three.pam four.pam
+
+
+-Do the same but with more abrupt transitions: ++
Do the same but with more abrupt transitions:
+ +
+ pammixmulti -blend=mask -maskfile=mask.pgm -stdev=0.0 >output.pam \
+ one.pam two.pam three.pam four.pam
+
+
+-and now with more gradual transitions: ++
and now with more gradual transitions:
+ +
+ pammixmulti -blend=mask -maskfile=mask.pgm -stdev=1.0 >output.pam \
+@@ -139,12 +139,12 @@ pixel-by-pixel basis:
+
+ HISTORY
+
+-pammixmulti was new in Netpbm 10.85 (December 2018).
++
pammixmulti was new in Netpbm 10.85 (December 2018).
+
+
+ AUTHOR
+
+-Copyright 2018–2024 Scott Pakin, scott+pbm@pakin.org.
++
Copyright 2018–2024 Scott Pakin, scott+pbm@pakin.org.
+
+ SEE ALSO
+
+@@ -152,20 +152,20 @@ pixel-by-pixel basis:
+ ppmmix,
+ pamarith,
+ pnm,
+-pam
++pam
+
+
+ Table Of Contents
+
+
+-- SYNOPSIS
+-
- DESCRIPTION
+-
- OPTIONS
+-
- ARGUMENTS
+-
- EXAMPLES
+-
- HISTORY
+-
- AUTHOR
+-
- SEE ALSO
++
- SYNOPSIS
++- DESCRIPTION
++- OPTIONS
++- ARGUMENTS
++- EXAMPLES
++- HISTORY
++- AUTHOR
++- SEE ALSO
+
+
+
+diff -urNp a/userguide/pampaintspill.html b/userguide/pampaintspill.html
+--- a/userguide/pampaintspill.html 2025-02-04 10:47:27.823451565 +0100
++++ b/userguide/pampaintspill.html 2025-02-04 18:01:50.746117598 +0100
+@@ -7,7 +7,7 @@ Updated: 02 November 2021
+ Table Of Contents
+
+ NAME
+-pampaintspill - smoothly spill colors into the background
++pampaintspill - smoothly spill colors into the background
+
+ SYNOPSIS
+
+@@ -19,48 +19,48 @@ pampaintspill - smoothly spill colors in
+ [--downsample=number]
+ [--near=number]
+ [--power=number] [filename]
+-[-randomseed=integer]
++[-randomseed=integer]
+
+
+ Minimum unique abbreviations of option are acceptable. You may use
+ double hyphens instead of single hyphen to denote options. You may use
+ white space in place of the equals sign to separate an option name
+-from its value.
++from its value.
+
+ DESCRIPTION
+
+-This program is part of Netpbm.
++
This program is part of Netpbm.
+
+ pampaintspill produces a smooth color gradient from all of the
+ non-background-colored pixels in an input image, effectively "spilling
+ paint" onto the background. pampaintspill is similar to
+-pamgradient but differs in the following characteristics:
++pamgradient but differs in the following characteristics:
+
+
+ - pampaintspill accepts any number of paint
+ sources (non-background-colored pixels), which can lie anywhere
+ on the canvas. pamgradient accepts exactly
+- four paint sources, one in each corner of the image.
++ four paint sources, one in each corner of the image.
+
+ - pampaintspill requires an input image while
+ pamgradient generates a new image from
+- scratch.
++ scratch.
+
+ - pampaintspill can produce tileable output and
+ can control how tightly the gradient colors bind to their source
+- pixels.
++ pixels.
+
+
+ Results are generally best when the input image contains just a few, crisp
+ spots of color. Use your drawing program's pencil tool — as opposed to a
+-paintbrush or airbrush tool — with a small nib.
++paintbrush or airbrush tool — with a small nib.
+
+ OPTIONS
+
+ In addition to the options common to all programs based on libnetpbm
+ (most notably -quiet, see
+ Common Options), pampaintspill recognizes the following
+-command line options:
++command line options:
+
+
+ - --bgcolor=color
+@@ -117,45 +117,45 @@ command line options:
+ gradients away from them.
+
+ - -randomseed=integer
+-
- This is the seed for the random number generator that generates the
+- pixels.
++
- This is the seed fodr the random number generator that generates the
++ pixels.
+
+- Use this to ensure you get the same image on separate invocations.
++
Use this to ensure you get the same image on separate invocations.
+
+- This option was new in Netpbm 10.94 (March 2021).
++ This option was new in Netpbm 10.94 (March 2021).
+
+
+
+ SEE ALSO
+
+
+-- pamgradient
+-
- ppmmake,
+-
- ppmrainbow,
+-
- pgmramp,
+-
- ppmpat,
+-
- pam
++
- pamgradient
++- ppmmake,
++- ppmrainbow,
++- pgmramp,
++- ppmpat,
++- pam
+
+
+ HISTORY
+
+-pampaintspill was new in Netpbm 10.50 (March 2010).
++
pampaintspill was new in Netpbm 10.50 (March 2010).
+
+
+ COPYRIGHT
+
+ Copyright © 2010–2021 Scott Pakin,
+-scott+pbm@pakin.org.
++scott+pbm@pakin.org.
+
+ Table Of Contents
+
+
+-- SYNOPSIS
+-
- DESCRIPTION
+-
- OPTIONS
+-
- SEE ALSO
+-
- HISTORY
+-
- COPYRIGHT
++
- SYNOPSIS
++- DESCRIPTION
++- OPTIONS
++- SEE ALSO
++- HISTORY
++- COPYRIGHT
+
+
+
+diff -urNp a/userguide/pamrecolor.html b/userguide/pamrecolor.html
+--- a/userguide/pamrecolor.html 2025-02-04 10:47:27.823451565 +0100
++++ b/userguide/pamrecolor.html 2025-02-04 18:10:00.968545076 +0100
+@@ -2,9 +2,9 @@
+ Pamrecolor User Manual
-@@ -11,6 +10,7 @@
+ pamrecolor
+-Updated: 31 July 2010
++Updated: 31 July 2010
+
+-Table Of Contents
++Table Of Contents
-
+ NAME
+ pamrecolor - alter colors without affecting luminance
+@@ -22,15 +22,15 @@ pamrecolor - alter colors without affect
+ [-randomseed=integer]
-+NAME
- pampaintspill - smoothly spill colors into the background
+ [infile]
+-
++
- SYNOPSIS
-diff -up netpbm-10.59.03/userguide/pamrecolor.html.manfix netpbm-10.59.03/userguide/pamrecolor.html
---- netpbm-10.59.03/userguide/pamrecolor.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/pamrecolor.html 2012-09-25 10:47:22.757174803 +0200
-@@ -1,8 +1,7 @@
--
-+
-
-
- Pamrecolor User Manual
--
-
+ Minimum unique abbreviation of option is acceptable. You may use double
+ hyphens instead of single hyphen to denote options. You may use white
+-space in place of the equals sign to separate an option name from its value.
++space in place of the equals sign to separate an option name from its value.
-
-@@ -11,7 +10,7 @@
+ DESCRIPTION
- Updated: 31 July 2010
+-This program is part of Netpbm.
++
This program is part of Netpbm.
--
-+
+ pamrecolor changes an image's colors to be as close as
+ possible to given target colors but with the constraint that the
+@@ -39,17 +39,17 @@ image will look identical if both are co
+ (e.g. with
+ ppmtopgm). You can have pamrecolor select
+ target colors randomly, specify a single hue for the entire image, or take the
+-target colors from a target image.
++target colors from a target image.
+
+ In addition to real Netpbm images, pamrecolor works on pseudo-Netpbm
+ images based on arbitrary color spaces. You can define the color space
+-explicitly or choose one of many that pamrecolor knows by name.
++explicitly or choose one of many that pamrecolor knows by name.
+
+ The output is a PAM image on standard output. Options control the
+ exact format of the PAM. If you want a PNM (PBM, PGM, or PPM) image,
+ use pamtopnm on the output. There is no
+ need to convert if you will use the image as input to a current Netpbm
+-program, but many other programs don't know what a PAM is.
++program, but many other programs don't know what a PAM is.
- NAME
-diff -up netpbm-10.59.03/userguide/pamsistoaglyph.html.manfix netpbm-10.59.03/userguide/pamsistoaglyph.html
---- netpbm-10.59.03/userguide/pamsistoaglyph.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/pamsistoaglyph.html 2012-09-25 10:47:22.758174790 +0200
-@@ -1,8 +1,7 @@
-
--
-+
-
- Pamsistoaglyph User Manual
--
-
+ OPTIONS
+@@ -57,7 +57,7 @@ program, but many other programs don't k
+ In addition to the options common to all programs based on libnetpbm
+ (most notably -quiet, see
+ Common Options), pamrecolor recognizes the following
+-command line options:
++command line options:
-
-diff -up netpbm-10.59.03/userguide/pamtoavs.html.manfix netpbm-10.59.03/userguide/pamtoavs.html
---- netpbm-10.59.03/userguide/pamtoavs.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/pamtoavs.html 2012-09-25 10:47:22.759174777 +0200
-@@ -1,8 +1,7 @@
--
--
-+
-+
-
- Pamtoavs User Manual
--
-
+
-
-diff -up netpbm-10.59.03/userguide/pamtooctaveimg.html.manfix netpbm-10.59.03/userguide/pamtooctaveimg.html
---- netpbm-10.59.03/userguide/pamtooctaveimg.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/pamtooctaveimg.html 2012-09-25 10:47:22.759174777 +0200
-@@ -1,8 +1,7 @@
--
--
-+
-+
-
- Pamtooctaveimg User Manual
--
-
+@@ -67,7 +67,7 @@ to luminance of each of the red, green,
+ example, in the SMPTE-C color space an RGB color is converted to
+ grayscale by multiplying the red channel by 0.2124132, the green
+ channel by 0.7010437, and the blue channel by 0.0865432 and summing
+-the resulting three products.
++the resulting three products.
-
-diff -up netpbm-10.59.03/userguide/pnmflip.html.manfix netpbm-10.59.03/userguide/pnmflip.html
---- netpbm-10.59.03/userguide/pnmflip.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/pnmflip.html 2012-09-25 10:47:22.760174765 +0200
-@@ -4,9 +4,11 @@
-
- pnmflip
-
-+NAME
- pnmflip was replaced in Netpbm 10.13 (December 2002) by
- pamflip.
+
When you use this option, the input and output images are not true Netpbm
+ images, because the Netpbm image format specifies a particular color space.
+@@ -76,9 +76,9 @@ the raster have different meaning. Many
+ images actually use a variation with a different color space. For example,
+ GIMP uses sRGB internally and if you
+ have GIMP generate a Netpbm image file, it really generates a variation of
+-the format that uses sRGB.
++the format that uses sRGB.
-+DESCRIPTION
- pamflip is mostly backward compatible with pnmflip,
- but works on PAM images too.
+-
pamrecolor knows the following color spaces (name values):
++
pamrecolor knows the following color spaces (name values):
-diff -up netpbm-10.59.03/userguide/pnmmercator.html.manfix netpbm-10.59.03/userguide/pnmmercator.html
---- netpbm-10.59.03/userguide/pnmmercator.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/pnmmercator.html 2012-09-25 10:47:22.760174765 +0200
-@@ -1,7 +1,6 @@
--
-+
-
-
--
- PnmMercator User Manual
-
-
-diff -up netpbm-10.59.03/userguide/pnmtotiff.html.manfix netpbm-10.59.03/userguide/pnmtotiff.html
---- netpbm-10.59.03/userguide/pnmtotiff.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/pnmtotiff.html 2012-09-25 10:47:22.760174765 +0200
-@@ -1,5 +1,4 @@
-
--
-
- pnmtotiff
-
-diff -up netpbm-10.59.03/userguide/ppmtogif.html.manfix netpbm-10.59.03/userguide/ppmtogif.html
---- netpbm-10.59.03/userguide/ppmtogif.html.manfix 2012-09-22 03:46:15.000000000 +0200
-+++ netpbm-10.59.03/userguide/ppmtogif.html 2012-09-25 10:47:22.761174753 +0200
-@@ -4,11 +4,14 @@
-
- ppmtogif
-
-+NAME
+
+ - adobe
+@@ -109,12 +109,12 @@ the format that uses sRGB.
+ The default is "ntsc" because this is the color space that the Netpbm
+ formats and many graphics utilities use. As a counterexample,
+ GIMP uses sRGB as its native color
+-space.
++space.
+
+ The luminance values pamrecolor uses for each of the above come from
+ Bruce Lindbloom's
+
+-Computing RGB-to-XYZ and XYZ-to-RGB matrices page.
++Computing RGB-to-XYZ and XYZ-to-RGB matrices page.
+
+ - --rmult=fraction
+ - --gmult=fraction
+@@ -133,15 +133,13 @@ image. pamrecolor will make each
+ to color subject to the constraint that the luminance must stay the
+ same as in the original image. Specify color as in
+ the argument of the pnm_parsecolor()
+-library routine (e.g., "hotpink" or "#ff69b4").
++library routine (e.g., "hotpink" or "#ff69b4").
+
+ If you specify neither --targetcolor nor
+ --colorfile, pamrecolor will randomly select a target color for
+-each pixel of the input image.
+-
+-
You may not specify both -targetcolor and -colorfile.
++each pixel of the input image.
+
+-
++You may not specify both -targetcolor and -colorfile.
+
+ - --colorfile=file
+ - Take per-pixel target colors from Netpbm file file instead
+@@ -150,40 +148,38 @@ of using a single target color for the e
+ If the image in the file wider or taller than the input image,
+ pamrecolor uses only the left and top part of it.
+ If the image is narrower or shorter, pamrecolor considers the
+-image to be repeated in a tile pattern.
++image to be repeated in a tile pattern.
+
+ If you specify neither --targetcolor nor
+ --colorfile, pamrecolor will randomly select a target color for
+-each pixel of the input image.
++each pixel of the input image.
+
+-You may not specify both -targetcolor and -colorfile.
++
You may not specify both -targetcolor and -colorfile.
+
+-- -randomseed=integer
++
- -randomseed=integer
+
+ - This is the seed for the random number generator that generates the
+-pixels.
++pixels.
+
+-Use this to ensure you get the same image on separate invocations.
++
Use this to ensure you get the same image on separate invocations.
+
+ By default, pamrecolor uses a seed derived from the time of day
+ and process ID, which gives you fairly uncorrelated results in multiple
+-invocations.
+-
+-
This option was new in Netpbm 10.61 (December 2012).
++invocations.
+
+-
++This option was new in Netpbm 10.61 (December 2012).
+
+
+ EXAMPLES
+
+-This command tints an image yellow:
++
This command tints an image yellow:
+
+
+ pamrecolor --targetcolor=yellow colorpic.pam > yellowpic.pam
+
+
+ This command takes the colors from colorpicture.ppm and applies
+-them to graypicture.pgm:
++them to graypicture.pgm:
+
+
+ pamrecolor --colorfile=colorpic.ppm graypic.pgm > colorizedpic.pam
+@@ -192,52 +188,52 @@ them to graypicture.pgm:
+ The grayscale version of colorizedpic.pam will look just like
+ graypic.pgm. Note that if you use a non-Netpbm tool to do the conversion to
+ grayscale, you may additionally need to specify an
+-appropriate --colorspace value for your conversion tool.
++appropriate --colorspace value for your conversion tool.
+
+
+ NOTES
+
+ Here are a couple of fun special effects you can produce with
+-pamrecolor:
++pamrecolor:
+
+
+ - Specify a color file that is identical to the input image but with
+ some large, colored text added to it. The text will "magically"
+-vanish when the image is converted to grayscale.
++vanish when the image is converted to grayscale.
+
+ - Provide a low-contrast grayscale image — perhaps a secret
+ message written in similar shades of gray — as the input file and
+ a colorful but completely different image as the color file. If done
+ carefully, the grayscale image can be hidden by the colorful image.
+ Only people who know to convert the result to grayscale can recover
+-the original grayscale image.
++the original grayscale image.
+
+ - Use --targetcolor=tan to make an image look like an
+ old-timey photograph (or, more precisely, a
+ sepia-toned
+-photograph of the late 1800s).
++photograph of the late 1800s).
+
+
+
+ HISTORY
+
+-Scott Pakin wrote pamrecolor in July 2010.
++
Scott Pakin wrote pamrecolor in July 2010.
+
+-pamrecolor was new in Netpbm 10.52 (September 2010).
++
pamrecolor was new in Netpbm 10.52 (September 2010).
+
+
+ AUTHOR
+
+ Copyright (C) 2010 Scott
+-Pakin, scott+pbm@pakin.org
++Pakin, scott+pbm@pakin.org
+
+
+ SEE ALSO
+
+
+
+
+@@ -246,14 +242,14 @@ Pakin, Table Of Contents
+
+
+-- SYNOPSIS
+-
- DESCRIPTION
+-
- OPTIONS
+-
- EXAMPLES
+-
- NOTES
+-
- HISTORY
+-
- AUTHOR
+-
- SEE ALSO
++
- SYNOPSIS
++- DESCRIPTION
++- OPTIONS
++- EXAMPLES
++- NOTES
++- HISTORY
++- AUTHOR
++- SEE ALSO
+
+
+
+diff -urNp a/userguide/pbmtog3.html b/userguide/pbmtog3.html
+--- a/userguide/pbmtog3.html 2025-02-04 10:47:27.827451549 +0100
++++ b/userguide/pbmtog3.html 2025-02-04 18:10:55.328259786 +0100
+@@ -80,7 +80,7 @@ You cannot specify both.
+ HISTORY
+
+ Before Netpbm 10.79 (June 2017), there was a different program by the same
+-name in Netpbm, which was written by by Paul Haeberli
++name in Netpbm, which was written by Paul Haeberli
+ <paul@manray.sgi.com> in 1989
+ and then modified extensively by others.
+
+diff -urNp a/userguide/ppmtogif.html b/userguide/ppmtogif.html
+--- a/userguide/ppmtogif.html 2025-02-04 10:47:27.828451545 +0100
++++ b/userguide/ppmtogif.html 2025-02-04 18:12:39.950710820 +0100
+@@ -5,17 +5,17 @@
+
+
NAME
+
+-ppmtogif - replaced by pamtogif
+-
+-DESCRIPTION
++ppmtogif - replaced by pamtogif
+
+ This program is part of Netpbm.
+
++
SYNOPSIS
ppmtogif was replaced in Netpbm 10.37 (December 2006) by
pamtogif.
-+
SYNOPSIS
- pamtogif is mostly backward compatible with ppmtogif.
+
pamtogif is mostly backward compatible with ppmtogif.
-+
DESCRIPTION
- One way pamtogif is not backward compatible with ppmtogif
++
DESCRIPTION
+ One way pamtogif is not backward compatible with ppmtogif
is that to specify a transparency (alpha) mask with ppmtogif, you
supply the transparency as a separate pseudo-PGM image and use the
-diff -up netpbm-10.61.02/userguide/pamstereogram.html.manfix netpbm-10.61.02/userguide/pamstereogram.html
---- netpbm-10.61.02/userguide/pamstereogram.html.manfix 2013-02-20 07:32:26.000000000 +0100
-+++ netpbm-10.61.02/userguide/pamstereogram.html 2013-02-20 07:40:35.071099535 +0100
-@@ -1,5 +1,5 @@
--
--
-+
-+
-
- Pamstereogram User Manual
-
-@@ -10,8 +10,7 @@
-
- Updated:30 December 2012
-
--
--
-+
-
- NAME
-
diff --git a/netpbm-message.patch b/netpbm-message.patch
deleted file mode 100644
index 0a820fc..0000000
--- a/netpbm-message.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up netpbm-10.59.01/converter/other/giftopnm.c.message netpbm-10.59.01/converter/other/giftopnm.c
---- netpbm-10.59.01/converter/other/giftopnm.c.message 2012-07-11 05:54:52.000000000 +0200
-+++ netpbm-10.59.01/converter/other/giftopnm.c 2012-07-11 05:57:57.745246980 +0200
-@@ -2038,7 +2038,7 @@ convertImages(FILE * const ifP,
- imageSeq, imageSeq > 1 ? "s" : "");
- } else {
- if (verbose)
-- pm_message("Reading Image Sequence %u", imageSeq);
-+ pm_message("Reading Image Sequence %u", imageSeq+1);
-
- convertImage(ifP, !allImages && (imageSeq != requestedImageSeq),
- imageOutFileP, alphaFileP, gifScreen, gif89,
diff --git a/netpbm-nodoc.patch b/netpbm-nodoc.patch
deleted file mode 100644
index c35cd9e..0000000
--- a/netpbm-nodoc.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/GNUmakefile b/GNUmakefile
-index b0b7f00..a46329d 100644
---- a/GNUmakefile
-+++ b/GNUmakefile
-@@ -369,7 +369,7 @@ install.lib:
- endif
-
- .PHONY: install.manwebmain
--install.manwebmain: $(PKGDIR)/man/web/netpbm.url $(PKGDIR)/bin/doc.url
-+install.manwebmain: $(PKGDIR)/man/web/netpbm.url
-
- $(PKGDIR)/man/web/netpbm.url: $(PKGDIR)/man/web
- echo "$(NETPBM_DOCURL)" > $@
diff --git a/netpbm-noppmtompeg.patch b/netpbm-noppmtompeg.patch
deleted file mode 100644
index 58b7fa8..0000000
--- a/netpbm-noppmtompeg.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff -up netpbm-10.47.12/buildtools/manpage.mk.noppmtompeg netpbm-10.47.12/buildtools/manpage.mk
---- netpbm-10.47.12/buildtools/manpage.mk.noppmtompeg 2010-04-27 09:54:52.121522491 -0400
-+++ netpbm-10.47.12/buildtools/manpage.mk 2010-04-27 09:55:10.337642487 -0400
-@@ -251,7 +251,6 @@ MAN1 = \
- ppmtolj.1 \
- ppmtomap.1 \
- ppmtomitsu.1 \
-- ppmtompeg.1 \
- ppmtoneo.1 \
- ppmtopcx.1 \
- ppmtopgm.1 \
-diff -up netpbm-10.47.12/converter/ppm/Makefile.noppmtompeg netpbm-10.47.12/converter/ppm/Makefile
---- netpbm-10.47.12/converter/ppm/Makefile.noppmtompeg 2010-04-27 09:55:20.293517254 -0400
-+++ netpbm-10.47.12/converter/ppm/Makefile 2010-04-27 09:55:41.534642567 -0400
-@@ -7,7 +7,7 @@ VPATH=.:$(SRCDIR)/$(SUBDIR)
-
- include $(BUILDDIR)/config.mk
-
--SUBDIRS = hpcdtoppm ppmtompeg
-+SUBDIRS = hpcdtoppm
-
- PORTBINARIES = 411toppm eyuvtoppm gouldtoppm ilbmtoppm imgtoppm \
- leaftoppm mtvtoppm neotoppm \
diff --git a/netpbm-pamtojpeg2k.patch b/netpbm-pamtojpeg2k.patch
index 9615ce7..8fbd899 100644
--- a/netpbm-pamtojpeg2k.patch
+++ b/netpbm-pamtojpeg2k.patch
@@ -1,11 +1,11 @@
diff -up netpbm-10.47.12/converter/other/jpeg2000/pamtojpeg2k.c.pamtojpeg2kfix netpbm-10.47.12/converter/other/jpeg2000/pamtojpeg2k.c
--- netpbm-10.47.12/converter/other/jpeg2000/pamtojpeg2k.c.pamtojpeg2kfix 2010-04-27 15:47:10.000000000 +0200
+++ netpbm-10.47.12/converter/other/jpeg2000/pamtojpeg2k.c 2010-05-03 15:37:49.934269588 +0200
-@@ -518,7 +518,5 @@ main(int argc, char **argv)
+@@ -532,7 +532,5 @@ main(int argc, char **argv)
pm_close(ifP);
- pm_close(stdout);
--
+-
return 0;
}
diff --git a/netpbm-pnmtopclxl.patch b/netpbm-pnmtopclxl.patch
deleted file mode 100644
index dc67040..0000000
--- a/netpbm-pnmtopclxl.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff -up netpbm-10.58.01/converter/other/pnmtopclxl.c.pnmtopclxl netpbm-10.58.01/converter/other/pnmtopclxl.c
---- netpbm-10.58.01/converter/other/pnmtopclxl.c.pnmtopclxl 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/other/pnmtopclxl.c 2012-06-13 15:39:17.566141565 +0200
-@@ -269,10 +269,10 @@ XY_RLEnew(size_t const size) {
-
- MALLOCVAR(rleP);
- if (rleP) {
-- rleP->fbuf = malloc(size);
-+ rleP->fbufsize = MAX(1024, size);
-+ rleP->fbuf = malloc(rleP->fbufsize);
-
- if (rleP->fbuf) {
-- rleP->fbufsize = MAX(1024, size);
- retval = rleP;
- } else
- retval = NULL;
diff --git a/netpbm-pnmtops.patch b/netpbm-pnmtops.patch
deleted file mode 100644
index 31bce9e..0000000
--- a/netpbm-pnmtops.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/converter/other/Makefile b/converter/other/Makefile
-index 7aefda1..0d998f6 100644
---- a/converter/other/Makefile
-+++ b/converter/other/Makefile
-@@ -121,7 +121,7 @@ PORTBINARIES = avstopam bmptopnm fitstopnm \
- pamtowinicon pamtoxvmini \
- pbmtopgm pdbimgtopam pfmtopam \
- pgmtopbm pgmtoppm ppmtopgm pnmtoddif \
-- pnmtopclxl pnmtorast \
-+ pnmtopclxl pnmtops pnmtorast \
- pnmtosgi pnmtosir pamtotga pnmtoxwd \
- rasttopnm rlatopam sgitopnm sirtopnm srftopam sunicontopnm \
- winicontopam xwdtopnm zeisstopnm
diff --git a/netpbm-ppmfadeusage.patch b/netpbm-ppmfadeusage.patch
index 88ad44c..2943ddb 100644
--- a/netpbm-ppmfadeusage.patch
+++ b/netpbm-ppmfadeusage.patch
@@ -1,67 +1,62 @@
-diff -up netpbm-10.47.09/editor/ppmfade.ppmfadeusage netpbm-10.47.09/editor/ppmfade
---- netpbm-10.47.09/editor/ppmfade.ppmfadeusage 2010-02-17 11:22:02.000000000 +0100
-+++ netpbm-10.47.09/editor/ppmfade 2010-02-17 11:27:29.000000000 +0100
-@@ -34,7 +34,6 @@ my $base_name = "fade"; # default base
- my $image = "ppm"; # default output storage format
- my $mode = $SPREAD; # default fading mode
-
--
- my $n; # argument number
-
- for ($n = 0; $n < @ARGV; $n++) {
-@@ -44,7 +43,7 @@ for ($n = 0; $n < @ARGV; $n++) {
- if (-e $first_file) {
+diff -urNp a/editor/ppmfade b/editor/ppmfade
+--- a/editor/ppmfade 2025-02-04 10:47:27.812451607 +0100
++++ b/editor/ppmfade 2025-02-04 10:52:14.233336029 +0100
+@@ -99,6 +99,9 @@ sub commandLineArgs() {
+ $mode = 'BLOCK';
+ } elsif ($arg eq "-mix") {
+ $mode = 'MIX';
++ } elsif ($arg eq "-help" || $arg eq "--help" || $arg eq "-h") {
++ print STDERR ("ppmfade: Use 'man ppmfade' for help.\n");
++ exit 1;
} else {
- print "I can't find first file '$first_file'\n";
-- exit 20;
+ if (substr($arg, 0, 1) eq '-') {
+ print STDERR ("Unknown option '$arg'. " .
+@@ -109,13 +112,13 @@ sub commandLineArgs() {
+ print STDERR ("There are no non-option arguments possible. " .
+ "You specified '$arg'\n");
+ }
+- exit 100;
+ exit 1;
}
- } elsif ($ARGV[$n] eq "-l") {
- $n++;
-@@ -52,7 +51,7 @@ for ($n = 0; $n < @ARGV; $n++) {
- if (-e $last_file) {
+ }
+
+ if (!defined($firstFileNm) && !defined($lastFileNm)) {
+ print STDERR ("You must specify -f or -l (or both)\n");
+- exit 90;
++ exit 1
+ }
+
+ if (!defined($mode)) {
+@@ -142,7 +145,7 @@ sub imageDimensions($$) {
} else {
- print "I can't find last file '$last_file'\n";
-- exit 20;
-+ exit 1;
+ print STDERR
+ ("Unrecognized results from pnmfile on $firstFileNm.\n");
+- exit(50);
++ exit(1);
}
- } elsif ($ARGV[$n] eq "-base") {
- $n++;
-@@ -73,11 +72,12 @@ for ($n = 0; $n < @ARGV; $n++) {
- $mode = $BLOCK;
- } elsif ("$ARGV[$n]" eq "-mix") {
- $mode = $MIX;
-- } elsif ($ARGV[$n] eq "-help" || $ARGV[$n] eq "-h") {
-- usage();
-+ } elsif ($ARGV[$n] eq "-help" || $ARGV[$n] eq "--help" || $ARGV[$n] eq "-h") {
-+ print "ppmfade: Use 'man ppmfade' for help.\n";
-+ exit 1;
} else {
- print "Unknown argument: $ARGV[$n]\n";
-- exit 100;
-+ exit 1;
- }
- }
- #
-@@ -96,18 +96,18 @@ if ($first_file ne "undefined") {
- $width = $1; $height = $2;
- } else {
- print("Unrecognized results from pnmfile on $first_file.\n");
-- exit(50);
-+ exit 1;
+ # $lastFileNm is defined
+@@ -151,7 +154,7 @@ sub imageDimensions($$) {
+ } else {
+ print STDERR
+ ("Unrecognized results from pnmfile on $firstFileNm.\n");
+- exit(50);
++ exit(1);
+ }
}
- } elsif ($last_file ne "undefined") {
- if ((`pnmfile $last_file` =~ m{\b(\d+)\sby\s(\d+)} )) {
- $width = $1; $height = $2;
- } else {
- print("Unrecognized results from pnmfile on $first_file.\n");
-- exit(50);
-+ exit 1;
- }
- } else {
- print("ppmfade: You must specify -f or -l (or both)\n");
-- exit(90);
+ return $width, $height;
+@@ -436,12 +439,12 @@ my ($mode, $firstFileNm, $lastFileNm, $b
+
+ if (defined($firstFileNm) && !-e($firstFileNm)) {
+ print STDERR ("First file '$firstFileNm' does not exist\n");
+- exit 20;
+ exit 1;
}
- print("Frames are " . $width . "W x " . $height . "H\n");
+ if (defined($lastFileNm) && !-e($lastFileNm)) {
+ print STDERR ("Last file '$lastFileNm' does not exist\n");
+- exit 20;
++ exit 1;
+ }
+
+ my ($width, $height) = imageDimensions($firstFileNm, $lastFileNm);
diff --git a/netpbm-ppmtopict.patch b/netpbm-ppmtopict.patch
deleted file mode 100644
index 97b7d2b..0000000
--- a/netpbm-ppmtopict.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up netpbm-10.58.01/converter/ppm/ppmtopict.c.ppmtopict netpbm-10.58.01/converter/ppm/ppmtopict.c
---- netpbm-10.58.01/converter/ppm/ppmtopict.c.ppmtopict 2012-06-13 09:52:42.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/ppmtopict.c 2012-06-13 11:33:11.134747363 +0200
-@@ -200,7 +200,7 @@ putRow(FILE * const ifP,
- pixel * const rowpixels,
- char * const packed) {
-
-- unsigned int i;
-+ int i;
- unsigned int count;
- unsigned int run;
- unsigned int rep;
diff --git a/netpbm-python3.patch b/netpbm-python3.patch
new file mode 100644
index 0000000..2557933
--- /dev/null
+++ b/netpbm-python3.patch
@@ -0,0 +1,28 @@
+diff --git a/buildtools/makeman b/buildtools/makeman
+index 196dbd0..d73ab76 100755
+--- a/buildtools/makeman
++++ b/buildtools/makeman
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ #
+ # makeman -- compile netpbm's stereotyped HTML to troff markup
+ #
+diff --git a/buildtools/manpage.mk b/buildtools/manpage.mk
+index ef1a103..c1badb8 100644
+--- a/buildtools/manpage.mk
++++ b/buildtools/manpage.mk
+@@ -126,11 +126,11 @@ reportman:
+ # to standard error.
+ %.1 %.3 %.5: $(USERGUIDE)/%.html
+ @echo Converting $< to $@
+- @python $(MAKEMAN) -d $(USERGUIDE) $(= nl); assert(nh <= UINT_MAX-1);
- assert(nh >= nl);
--
+ overflow_add(nh - nl, 1);
++
MALLOCARRAY(v, (unsigned) (nh - nl + 1));
if (v == NULL)
-@@ -129,6 +129,7 @@ matrix (unsigned int const nrl,
- assert(nrh >= nrl);
+@@ -133,6 +135,8 @@ matrix (unsigned int const nrl,
+
+ assert(nrh >= nrl); assert(nrh <= UINT_MAX-1);
- /* allocate pointers to rows */
+ overflow_add(nrh - nrl, 1);
- MALLOCARRAY(m, (unsigned) (nrh - nrl + 1));
- if (m == NULL)
- pm_error("Unable to allocate memory for a matrix.");
-@@ -136,7 +137,7 @@ matrix (unsigned int const nrl,
- m -= ncl;
++
+ /* allocate pointers to rows */
+ MALLOCARRAY(matrix, (unsigned) (nrh - nrl + 1));
+ if (matrix == NULL)
+@@ -142,6 +146,8 @@ matrix (unsigned int const nrl,
+
+ assert (nch >= ncl); assert(nch <= UINT_MAX-1);
- assert (nch >= ncl);
--
+ overflow_add(nch - ncl, 1);
++
/* allocate rows and set pointers to them */
for (i = nrl; i <= nrh; ++i) {
- MALLOCARRAY(m[i], (unsigned) (nch - ncl + 1));
-diff -up netpbm-10.58.01/converter/other/gemtopnm.c.security-code netpbm-10.58.01/converter/other/gemtopnm.c
---- netpbm-10.58.01/converter/other/gemtopnm.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/other/gemtopnm.c 2012-04-09 15:40:03.183620040 +0200
-@@ -106,6 +106,7 @@ main(argc, argv)
+ MALLOCARRAY(matrix[i], (unsigned) (nch - ncl + 1));
+diff -urNp a/converter/other/gemtopnm.c b/converter/other/gemtopnm.c
+--- a/converter/other/gemtopnm.c 2025-02-03 09:24:28.345500482 +0100
++++ b/converter/other/gemtopnm.c 2025-02-03 09:28:49.455092222 +0100
+@@ -153,6 +153,8 @@ main(int argc, const char ** argv) {
- pnm_writepnminit( stdout, cols, rows, MAXVAL, type, 0 );
+ pnm_writepnminit(stdout, cols, rows, MAXVAL, type, 0);
+ overflow_add(cols, padright);
- {
++
+ {
/* allocate input row data structure */
- int plane;
-diff -up netpbm-10.58.01/converter/other/jpegtopnm.c.security-code netpbm-10.58.01/converter/other/jpegtopnm.c
---- netpbm-10.58.01/converter/other/jpegtopnm.c.security-code 2012-04-09 15:31:40.000000000 +0200
-+++ netpbm-10.58.01/converter/other/jpegtopnm.c 2012-04-09 15:40:03.184620028 +0200
-@@ -861,6 +861,8 @@ convertImage(FILE *
+ unsigned int plane;
+diff -urNp a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c
+--- a/converter/other/jpegtopnm.c 2025-02-03 09:24:28.346500477 +0100
++++ b/converter/other/jpegtopnm.c 2025-02-03 09:29:57.845723398 +0100
+@@ -894,6 +894,8 @@ convertImage(FILE *
/* Calculate output image dimensions so we can allocate space */
jpeg_calc_output_dimensions(cinfoP);
@@ -50,21 +52,21 @@ diff -up netpbm-10.58.01/converter/other/jpegtopnm.c.security-code netpbm-10.58.
/* Start decompressor */
jpeg_start_decompress(cinfoP);
-diff -up netpbm-10.58.01/converter/other/pbmtopgm.c.security-code netpbm-10.58.01/converter/other/pbmtopgm.c
---- netpbm-10.58.01/converter/other/pbmtopgm.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/other/pbmtopgm.c 2012-04-09 15:40:03.184620028 +0200
-@@ -47,6 +47,7 @@ main(int argc, char *argv[]) {
- "than the image height (%u rows)", height, rows);
+diff -urNp a/converter/other/pbmtopgm.c b/converter/other/pbmtopgm.c
+--- a/converter/other/pbmtopgm.c 2025-02-03 09:24:28.346500477 +0100
++++ b/converter/other/pbmtopgm.c 2025-02-03 09:32:07.478024266 +0100
+@@ -88,6 +88,7 @@ main(int argc, const char ** argv) {
+ up = cmdline.convRows / 2; down = cmdline.convRows - up;
outrow = pgm_allocrow(cols) ;
-+ overflow2(width, height);
- maxval = MIN(PGM_OVERALLMAXVAL, width*height);
++ overflow2(cmdline.convCols, cmdline.convRows);
+ maxval = MIN(PGM_OVERALLMAXVAL, cmdline.convCols * cmdline.convRows);
pgm_writepgminit(stdout, cols, rows, maxval, 0) ;
-diff -up netpbm-10.58.01/converter/other/pnmtoddif.c.security-code netpbm-10.58.01/converter/other/pnmtoddif.c
---- netpbm-10.58.01/converter/other/pnmtoddif.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/other/pnmtoddif.c 2012-04-09 15:40:03.185620015 +0200
-@@ -632,6 +632,7 @@ main(int argc, char *argv[]) {
+diff -urNp a/converter/other/pnmtoddif.c b/converter/other/pnmtoddif.c
+--- a/converter/other/pnmtoddif.c 2025-02-03 09:24:28.346500477 +0100
++++ b/converter/other/pnmtoddif.c 2025-02-03 09:33:21.228626549 +0100
+@@ -627,6 +627,7 @@ main(int argc, char *argv[]) {
switch (PNM_FORMAT_TYPE(format)) {
case PBM_TYPE:
ip.bits_per_pixel = 1;
@@ -72,7 +74,7 @@ diff -up netpbm-10.58.01/converter/other/pnmtoddif.c.security-code netpbm-10.58.
ip.bytes_per_line = (cols + 7) / 8;
ip.spectral = 2;
ip.components = 1;
-@@ -647,6 +648,7 @@ main(int argc, char *argv[]) {
+@@ -642,6 +643,7 @@ main(int argc, char *argv[]) {
ip.polarity = 2;
break;
case PPM_TYPE:
@@ -80,157 +82,112 @@ diff -up netpbm-10.58.01/converter/other/pnmtoddif.c.security-code netpbm-10.58.
ip.bytes_per_line = 3 * cols;
ip.bits_per_pixel = 24;
ip.spectral = 5;
-diff -up netpbm-10.58.01/converter/other/pnmtojpeg.c.security-code netpbm-10.58.01/converter/other/pnmtojpeg.c
---- netpbm-10.58.01/converter/other/pnmtojpeg.c.security-code 2012-04-09 15:31:39.000000000 +0200
-+++ netpbm-10.58.01/converter/other/pnmtojpeg.c 2012-04-09 15:40:03.186620002 +0200
-@@ -605,7 +605,11 @@ read_scan_script(j_compress_ptr const ci
- want JPOOL_PERMANENT.
- */
- const unsigned int scan_info_size = nscans * sizeof(jpeg_scan_info);
-- jpeg_scan_info * const scan_info =
-+ const jpeg_scan_info * scan_info;
-+
-+ overflow2(nscans, sizeof(jpeg_scan_info));
-+
-+ scan_info =
- (jpeg_scan_info *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- scan_info_size);
-@@ -937,6 +941,8 @@ compute_rescaling_array(JSAMPLE ** const
- const long half_maxval = maxval / 2;
- long val;
+diff -urNp a/converter/other/pnmtops.c b/converter/other/pnmtops.c
+--- a/converter/other/pnmtops.c 2025-02-03 09:24:28.345500482 +0100
++++ b/converter/other/pnmtops.c 2025-02-03 09:42:01.586878661 +0100
+@@ -298,17 +298,21 @@ parseCommandLine(int argc, const char **
+ validateCompDimension(width, psScaleFactor, "-width value");
+ validateCompDimension(height, psScaleFactor, "-height value");
-+ overflow_add(maxval, 1);
-+ overflow2(maxval+1, sizeof(JSAMPLE));
- *rescale_p = (JSAMPLE *)
- (cinfo.mem->alloc_small) ((j_common_ptr) &cinfo, JPOOL_IMAGE,
- (size_t) (((long) maxval + 1L) *
-@@ -1015,6 +1021,7 @@ convert_scanlines(struct jpeg_compress_s
- */
-
- /* Allocate the libpnm output and compressor input buffers */
-+ overflow2(cinfo_p->image_width, cinfo_p->input_components);
- buffer = (*cinfo_p->mem->alloc_sarray)
- ((j_common_ptr) cinfo_p, JPOOL_IMAGE,
- (unsigned int) cinfo_p->image_width * cinfo_p->input_components,
-diff -up netpbm-10.58.01/converter/other/pnmtops.c.security-code netpbm-10.58.01/converter/other/pnmtops.c
---- netpbm-10.58.01/converter/other/pnmtops.c.security-code 2012-04-09 15:31:40.000000000 +0200
-+++ netpbm-10.58.01/converter/other/pnmtops.c 2012-04-09 15:40:03.187619989 +0200
-@@ -256,17 +256,21 @@ parseCommandLine(int argc, const char **
- validateCompDimension(width, 72, "-width value");
- validateCompDimension(height, 72, "-height value");
-
-+ overflow2(width, 72);
- cmdlineP->width = width * 72;
-+ overflow2(height, 72);
- cmdlineP->height = height * 72;
++ overflow2(width, psScaleFactor);
+ cmdlineP->width = width * psScaleFactor;
++ overflow2(height, psScaleFactor);
+ cmdlineP->height = height * psScaleFactor;
if (imagewidthSpec) {
- validateCompDimension(imagewidth, 72, "-imagewidth value");
-+ overflow2(imagewidth, 72);
- cmdlineP->imagewidth = imagewidth * 72;
+ validateCompDimension(imagewidth, psScaleFactor, "-imagewidth value");
++ overflow2(imagewidth, psScaleFactor);
+ cmdlineP->imagewidth = imagewidth * psScaleFactor;
}
else
cmdlineP->imagewidth = 0;
if (imageheightSpec) {
-- validateCompDimension(imagewidth, 72, "-imageheight value");
-+ validateCompDimension(imageheight, 72, "-imageheight value");
-+ overflow2(imageheight, 72);
- cmdlineP->imageheight = imageheight * 72;
+- validateCompDimension(imagewidth, psScaleFactor, "-imageheight value");
++ validateCompDimension(imageheight, psScaleFactor, "-imageheight value");
++ overflow2(imageheight, psScaleFactor);
+ cmdlineP->imageheight = imageheight * psScaleFactor;
}
else
-diff -up netpbm-10.58.01/converter/other/rletopnm.c.security-code netpbm-10.58.01/converter/other/rletopnm.c
---- netpbm-10.58.01/converter/other/rletopnm.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/other/rletopnm.c 2012-04-09 15:40:03.189619963 +0200
-@@ -19,6 +19,8 @@
- * If you modify this software, you should include a notice giving the
- * name of the person performing the modification, the date of modification,
- * and the reason for such modification.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
- */
- /*
- * rletopnm - A conversion program to convert from Utah's "rle" image format
-diff -up netpbm-10.58.01/converter/other/sirtopnm.c.security-code netpbm-10.58.01/converter/other/sirtopnm.c
---- netpbm-10.58.01/converter/other/sirtopnm.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/other/sirtopnm.c 2012-04-09 15:40:03.190619951 +0200
-@@ -69,6 +69,7 @@ char* argv[];
- }
- break;
- case PPM_TYPE:
-+ overflow3(cols, rows, 3);
- picsize = cols * rows * 3;
- planesize = cols * rows;
- if ( !( sirarray = (unsigned char*) malloc( picsize ) ) )
-diff -up netpbm-10.58.01/converter/other/tifftopnm.c.security-code netpbm-10.58.01/converter/other/tifftopnm.c
---- netpbm-10.58.01/converter/other/tifftopnm.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/other/tifftopnm.c 2012-04-09 15:40:03.191619939 +0200
-@@ -1279,7 +1279,9 @@ convertRasterByRows(pnmOut * const
- if (scanbuf == NULL)
- pm_error("can't allocate memory for scanline buffer");
+diff -urNp a/converter/other/sirtopnm.c b/converter/other/sirtopnm.c
+--- a/converter/other/sirtopnm.c 2025-02-03 09:24:28.347500471 +0100
++++ b/converter/other/sirtopnm.c 2025-02-03 09:44:25.547151413 +0100
+@@ -84,6 +84,7 @@ convertPpm(FILE * const ifP,
+ unsigned int const cols,
+ xel * const xelrow) {
++ overflow3(cols, rows, 3);
+ unsigned int const picsize = cols * rows * 3;
+ unsigned int const planesize = cols * rows;
+
+diff -urNp a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c
+--- a/converter/other/tifftopnm.c 2025-02-03 09:24:28.345500482 +0100
++++ b/converter/other/tifftopnm.c 2025-02-03 09:46:55.210395347 +0100
+@@ -1358,7 +1358,8 @@ convertRasterByRows(pnmOut * const
+ if (UINT_MAX/cols < spp)
+ pm_error("Image is too wide/deep (%u x %u) for computations",
+ cols, spp);
- MALLOCARRAY(samplebuf, cols * spp);
+ /* samplebuf is unsigned int * !!! */
-+ samplebuf = (unsigned int *) malloc3(cols , sizeof(unsigned int) , spp);
-+
++ samplebuf = (unsigned int *) malloc3(cols, sizeof(unsigned int), spp);
if (samplebuf == NULL)
pm_error("can't allocate memory for row buffer");
-diff -up netpbm-10.58.01/converter/other/xwdtopnm.c.security-code netpbm-10.58.01/converter/other/xwdtopnm.c
---- netpbm-10.58.01/converter/other/xwdtopnm.c.security-code 2012-04-09 15:31:40.000000000 +0200
-+++ netpbm-10.58.01/converter/other/xwdtopnm.c 2012-04-09 15:40:03.192619927 +0200
-@@ -209,6 +209,10 @@ processX10Header(X10WDFileHeader * cons
- *colorsP = pnm_allocrow(2);
- PNM_ASSIGN1((*colorsP)[0], 0);
- PNM_ASSIGN1((*colorsP)[1], *maxvalP);
+diff -urNp a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c
+--- a/converter/other/xwdtopnm.c 2025-02-03 09:24:28.345500482 +0100
++++ b/converter/other/xwdtopnm.c 2025-02-03 09:55:18.695851996 +0100
+@@ -243,6 +243,10 @@ processX10Header(X10WDFileHeader * cons
+ *colorsP = pnm_allocrow(*maxvalP + 1);
+ for (i = 0; i <= *maxvalP; ++i)
+ PNM_ASSIGN1((*colorsP)[i], i);
+ overflow_add(h10P->pixmap_width, 15);
+ if(h10P->pixmap_width < 0)
+ pm_error("assert: negative width");
+ overflow2((((h10P->pixmap_width + 15) / 16) * 16 - h10P->pixmap_width), 8);
*padrightP =
(((h10P->pixmap_width + 15) / 16) * 16 - h10P->pixmap_width) * 8;
- *bits_per_itemP = 16;
-@@ -634,6 +638,7 @@ processX11Header(X11WDFileHeader * cons
-
- *colsP = h11FixedP->pixmap_width;
- *rowsP = h11FixedP->pixmap_height;
+ *bitsPerItemP = 16;
+@@ -671,6 +675,7 @@ processX11Header(const X11WDFileHeader *
+ "%u bits per pixel, which is too many for this program "
+ "to compute",
+ h11FixedP->pixmap_width, h11FixedP->bits_per_pixel);
+ overflow2(h11FixedP->bytes_per_line, 8);
*padrightP =
h11FixedP->bytes_per_line * 8 -
h11FixedP->pixmap_width * h11FixedP->bits_per_pixel;
-diff -up netpbm-10.58.01/converter/pbm/mdatopbm.c.security-code netpbm-10.58.01/converter/pbm/mdatopbm.c
---- netpbm-10.58.01/converter/pbm/mdatopbm.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/mdatopbm.c 2012-04-09 15:40:03.192619927 +0200
-@@ -245,10 +245,13 @@ main(int argc, char **argv) {
- pm_readlittleshort(infile, &yy); nInCols = yy;
+diff -urNp a/converter/pbm/mdatopbm.c b/converter/pbm/mdatopbm.c
+--- a/converter/pbm/mdatopbm.c 2025-02-03 09:24:28.358500411 +0100
++++ b/converter/pbm/mdatopbm.c 2025-02-03 09:57:03.495422912 +0100
+@@ -283,11 +283,13 @@ main(int argc, const char **argv) {
+ pm_readlittleshort(ifP, &yy); nInCols = yy;
}
-
+
+ overflow2(nOutCols, 8);
nOutCols = 8 * nInCols;
nOutRows = nInRows;
-- if (bScale)
+- if (bScale)
+ if (bScale) {
+ overflow2(nOutRows, 2);
nOutRows *= 2;
+-
+ }
-
data = pbm_allocarray(nOutCols, nOutRows);
-
-diff -up netpbm-10.58.01/converter/pbm/mgrtopbm.c.security-code netpbm-10.58.01/converter/pbm/mgrtopbm.c
---- netpbm-10.58.01/converter/pbm/mgrtopbm.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/mgrtopbm.c 2012-04-09 15:40:03.193619915 +0200
-@@ -65,6 +65,8 @@ readMgrHeader(FILE * const ifP,
- if (head.h_high < ' ' || head.l_high < ' ')
- pm_error("Invalid width field in MGR header");
-
+
+ MALLOCARRAY_NOFAIL(mdrow, nInCols);
+diff -urNp a/converter/pbm/mgrtopbm.c b/converter/pbm/mgrtopbm.c
+--- a/converter/pbm/mgrtopbm.c 2025-02-03 09:24:28.358500411 +0100
++++ b/converter/pbm/mgrtopbm.c 2025-02-03 09:58:19.232265999 +0100
+@@ -105,6 +105,8 @@ readMgrHeader(FILE * const ifP,
+ interpHdrWidth (head, colsP);
+ interpHdrHeight(head, rowsP);
+
+ overflow_add(*colsP, pad);
+
- *colsP = (((int)head.h_wide - ' ') << 6) + ((int)head.l_wide - ' ');
- *rowsP = (((int)head.h_high - ' ') << 6) + ((int) head.l_high - ' ');
- *padrightP = ( ( *colsP + pad - 1 ) / pad ) * pad - *colsP;
-diff -up netpbm-10.58.01/converter/pbm/pbmtogem.c.security-code netpbm-10.58.01/converter/pbm/pbmtogem.c
---- netpbm-10.58.01/converter/pbm/pbmtogem.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtogem.c 2012-04-09 15:40:03.193619915 +0200
+ *padrightP = ((*colsP + pad - 1) / pad) * pad - *colsP;
+ }
+
+diff -urNp a/converter/pbm/pbmtogem.c b/converter/pbm/pbmtogem.c
+--- a/converter/pbm/pbmtogem.c 2025-02-03 09:24:28.358500411 +0100
++++ b/converter/pbm/pbmtogem.c 2025-02-03 10:25:34.259707343 +0100
@@ -79,6 +79,7 @@ putinit (int const rows, int const cols)
bitsperitem = 0;
bitshift = 7;
@@ -239,9 +196,9 @@ diff -up netpbm-10.58.01/converter/pbm/pbmtogem.c.security-code netpbm-10.58.01/
outmax = (cols + 7) / 8;
outrow = (unsigned char *) pm_allocrow (outmax, sizeof (unsigned char));
lastrow = (unsigned char *) pm_allocrow (outmax, sizeof (unsigned char));
-diff -up netpbm-10.58.01/converter/pbm/pbmtogo.c.security-code netpbm-10.58.01/converter/pbm/pbmtogo.c
---- netpbm-10.58.01/converter/pbm/pbmtogo.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtogo.c 2012-04-09 15:40:03.193619915 +0200
+diff -urNp a/converter/pbm/pbmtogo.c b/converter/pbm/pbmtogo.c
+--- a/converter/pbm/pbmtogo.c 2025-02-03 09:24:28.359500407 +0100
++++ b/converter/pbm/pbmtogo.c 2025-02-03 10:26:22.723447123 +0100
@@ -158,6 +158,7 @@ main(int argc,
bitrow = pbm_allocrow(cols);
@@ -250,14 +207,14 @@ diff -up netpbm-10.58.01/converter/pbm/pbmtogo.c.security-code netpbm-10.58.01/c
rucols = ( cols + 7 ) / 8;
bytesperrow = rucols; /* GraphOn uses bytes */
rucols = rucols * 8;
-diff -up netpbm-10.58.01/converter/pbm/pbmtolj.c.security-code netpbm-10.58.01/converter/pbm/pbmtolj.c
---- netpbm-10.58.01/converter/pbm/pbmtolj.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtolj.c 2012-04-09 15:40:03.194619902 +0200
-@@ -120,7 +120,11 @@ parseCommandLine(int argc, char ** argv,
+diff -urNp a/converter/pbm/pbmtolj.c b/converter/pbm/pbmtolj.c
+--- a/converter/pbm/pbmtolj.c 2025-02-03 09:24:28.357500417 +0100
++++ b/converter/pbm/pbmtolj.c 2025-02-03 10:29:37.442401385 +0100
+@@ -120,7 +120,11 @@ parseCommandLine(int argc, const char **
static void
allocateBuffers(unsigned int const cols) {
-+ overflow_add(cols, 8);
++ overflow_add(cols, 7);
rowBufferSize = (cols + 7) / 8;
+ overflow_add(rowBufferSize, 128);
+ overflow_add(rowBufferSize, rowBufferSize+128);
@@ -265,307 +222,162 @@ diff -up netpbm-10.58.01/converter/pbm/pbmtolj.c.security-code netpbm-10.58.01/c
packBufferSize = rowBufferSize + (rowBufferSize + 127) / 128 + 1;
deltaBufferSize = rowBufferSize + rowBufferSize / 8 + 10;
-diff -up netpbm-10.58.01/converter/pbm/pbmtomacp.c.security-code netpbm-10.58.01/converter/pbm/pbmtomacp.c
---- netpbm-10.58.01/converter/pbm/pbmtomacp.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtomacp.c 2012-04-09 15:40:03.195619889 +0200
-@@ -101,6 +101,7 @@ char *argv[];
- if( !lflg )
- left = 0;
+diff -urNp a/converter/pbm/pbmtomda.c b/converter/pbm/pbmtomda.c
+--- a/converter/pbm/pbmtomda.c 2025-02-03 09:24:28.357500417 +0100
++++ b/converter/pbm/pbmtomda.c 2025-02-03 10:31:40.714199457 +0100
+@@ -204,6 +204,7 @@ main(int argc, const char ** argv) {
-+ overflow_add(left, MAX_COLS - 1);
- if( rflg )
- { if( right - left >= MAX_COLS )
- right = left + MAX_COLS - 1;
-@@ -111,6 +112,8 @@ char *argv[];
- if( !tflg )
- top = 0;
-
-+ overflow_add(top, MAX_LINES - 1);
-+
- if( bflg )
- { if( bottom - top >= MAX_LINES )
- bottom = top + MAX_LINES - 1;
-diff -up netpbm-10.58.01/converter/pbm/pbmtomda.c.security-code netpbm-10.58.01/converter/pbm/pbmtomda.c
---- netpbm-10.58.01/converter/pbm/pbmtomda.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtomda.c 2012-04-09 15:40:03.195619889 +0200
-@@ -179,6 +179,7 @@ int main(int argc, char **argv)
-
- nOutRowsUnrounded = bScale ? nInRows/2 : nInRows;
+ nOutRowsUnrounded = cmdline.dscale ? nInRows/2 : nInRows;
+ overflow_add(nOutRowsUnrounded, 3);
nOutRows = ((nOutRowsUnrounded + 3) / 4) * 4;
- /* MDA wants rows a multiple of 4 */
+ /* MDA wants rows a multiple of 4 */
nOutCols = nInCols / 8;
-diff -up netpbm-10.58.01/converter/pbm/pbmtoppa/pbm.c.security-code netpbm-10.58.01/converter/pbm/pbmtoppa/pbm.c
---- netpbm-10.58.01/converter/pbm/pbmtoppa/pbm.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtoppa/pbm.c 2012-04-09 15:40:03.195619889 +0200
-@@ -105,6 +105,7 @@ int pbm_readline(pbm_stat* pbm,unsigned
- return 0;
+diff -urNp a/converter/pbm/pbmtoppa/pbm.c b/converter/pbm/pbmtoppa/pbm.c
+--- a/converter/pbm/pbmtoppa/pbm.c 2025-02-03 09:24:28.356500423 +0100
++++ b/converter/pbm/pbmtoppa/pbm.c 2025-02-03 10:48:49.928347495 +0100
+@@ -157,6 +157,7 @@ pbm_readline(pbm_stat * const pbmSt
+ break;
+ case P4: {
+ int tmp, tmp2;
++ overflow_add(pbmStatP->width, 7);
+ tmp = (pbmStatP->width+7)/8;
+ tmp2 = fread(data,1,tmp,pbmStatP->fptr);
+ if (tmp2 == tmp) {
+@@ -189,6 +190,7 @@ pbm_unreadline(pbm_stat * const pbmStatP
- case P4:
-+ overflow_add(pbm->width, 7);
- tmp=(pbm->width+7)/8;
- tmp2=fread(data,1,tmp,pbm->fptr);
- if(tmp2 == tmp)
-@@ -129,7 +130,8 @@ void pbm_unreadline (pbm_stat *pbm, void
- return;
-
- pbm->unread = 1;
-- pbm->revdata = malloc ((pbm->width+7)/8);
-+ overflow_add(pbm->width, 7);
-+ pbm->revdata = malloc((pbm->width+7)/8);
- memcpy (pbm->revdata, data, (pbm->width+7)/8);
- pbm->current_line--;
- }
-diff -up netpbm-10.58.01/converter/pbm/pbmtoppa/pbmtoppa.c.security-code netpbm-10.58.01/converter/pbm/pbmtoppa/pbmtoppa.c
---- netpbm-10.58.01/converter/pbm/pbmtoppa/pbmtoppa.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtoppa/pbmtoppa.c 2012-04-09 15:40:03.196619876 +0200
-@@ -441,6 +441,7 @@ main(int argc, char *argv[]) {
+ if (!pbmStatP->unread) {
+ pbmStatP->unread = 1;
++ overflow_add(pbmStatP->width, 7);
+ pbmStatP->revdata = malloc ((pbmStatP->width+7)/8);
+ memcpy(pbmStatP->revdata, data, (pbmStatP->width+7)/8);
+ --pbmStatP->current_line;
+diff -urNp a/converter/pbm/pbmtoppa/pbmtoppa.c b/converter/pbm/pbmtoppa/pbmtoppa.c
+--- a/converter/pbm/pbmtoppa/pbmtoppa.c 2025-02-03 09:24:28.356500423 +0100
++++ b/converter/pbm/pbmtoppa/pbmtoppa.c 2025-02-03 10:49:30.440158354 +0100
+@@ -456,6 +456,7 @@ main(int argc, char *argv[]) {
pm_error("main(): unrecognized parameter '%s'", argv[argn]);
}
+ overflow_add(Width, 7);
- Pwidth=(Width+7)/8;
- printer.fptr=out;
+ Pwidth = (Width+7)/8;
+ printer.fptr = ofP;
-diff -up netpbm-10.58.01/converter/pbm/pbmtoxbm.c.security-code netpbm-10.58.01/converter/pbm/pbmtoxbm.c
---- netpbm-10.58.01/converter/pbm/pbmtoxbm.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtoxbm.c 2012-04-09 15:40:03.196619876 +0200
-@@ -335,6 +335,8 @@ convertRaster(FILE * const ifP,
-
- unsigned char * bitrow;
- unsigned int row;
-+
-+ overflow_add(cols, padright);
+diff -urNp a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c
+--- a/converter/pbm/pbmtoxbm.c 2025-02-03 09:24:28.357500417 +0100
++++ b/converter/pbm/pbmtoxbm.c 2025-02-03 10:50:31.351873866 +0100
+@@ -370,6 +370,7 @@ convertRaster(FILE * const ifP,
putinit(xbmVersion);
-diff -up netpbm-10.58.01/converter/pbm/pbmtoybm.c.security-code netpbm-10.58.01/converter/pbm/pbmtoybm.c
---- netpbm-10.58.01/converter/pbm/pbmtoybm.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtoybm.c 2012-04-09 15:40:03.197619863 +0200
-@@ -113,6 +113,7 @@ main(int argc, const char *argv[]) {
- bitrow = pbm_allocrow(cols);
-
- /* Compute padding to round cols up to the nearest multiple of 16. */
-+ overflow_add(cols, 16);
- padright = ((cols + 15) / 16) * 16 - cols;
++ overflow_add(cols, padright);
+ bitrow = pbm_allocrow_packed(cols + padright);
- putinit(cols, rows);
-diff -up netpbm-10.58.01/converter/pbm/pbmtozinc.c.security-code netpbm-10.58.01/converter/pbm/pbmtozinc.c
---- netpbm-10.58.01/converter/pbm/pbmtozinc.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmtozinc.c 2012-04-09 15:40:03.197619863 +0200
-@@ -65,6 +65,7 @@ main(int argc, char * argv[]) {
- bitrow = pbm_allocrow( cols );
+ for (row = 0; row < rows; ++row) {
+diff -urNp a/converter/pbm/pktopbm.c b/converter/pbm/pktopbm.c
+--- a/converter/pbm/pktopbm.c 2025-02-03 09:24:28.357500417 +0100
++++ b/converter/pbm/pktopbm.c 2025-02-03 17:09:21.430572232 +0100
+@@ -454,6 +454,7 @@ readCharacterHeader(int * const
+ if (packetLength > UINT_MAX - pkLoc)
+ pm_error("Invalid character header - excessive packet length");
- /* Compute padding to round cols up to the nearest multiple of 16. */
-+ overflow_add(cols, 16);
- padright = ( ( cols + 15 ) / 16 ) * 16 - cols;
++ overflow_add(packetLength, pkLoc);
+ *endOfPacketP = packetLength + pkLoc;
- printf( "USHORT %s[] = {\n",name);
-diff -up netpbm-10.58.01/converter/pbm/pbmto10x.c.security-code netpbm-10.58.01/converter/pbm/pbmto10x.c
---- netpbm-10.58.01/converter/pbm/pbmto10x.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmto10x.c 2012-04-09 15:40:03.197619863 +0200
-@@ -162,7 +162,7 @@ main(int argc, char * argv[]) {
- res_60x72();
-
- pm_close(ifp);
-- exit(0);
-+ return 0;
- }
-
-
-diff -up netpbm-10.58.01/converter/pbm/pbmto4425.c.security-code netpbm-10.58.01/converter/pbm/pbmto4425.c
---- netpbm-10.58.01/converter/pbm/pbmto4425.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pbmto4425.c 2012-04-09 15:40:03.198619851 +0200
-@@ -2,6 +2,7 @@
-
- #include "nstring.h"
- #include "pbm.h"
-+#include
-
- static char bit_table[2][3] = {
- {1, 4, 0x10},
-@@ -160,7 +161,7 @@ main(int argc, char * argv[]) {
- xres = vmap_width * 2;
- yres = vmap_height * 3;
-
-- vmap = malloc(vmap_width * vmap_height * sizeof(char));
-+ vmap = malloc3(vmap_width, vmap_height, sizeof(char));
- if(vmap == NULL)
- {
- pm_error( "Cannot allocate memory" );
-diff -up netpbm-10.58.01/converter/pbm/pktopbm.c.security-code netpbm-10.58.01/converter/pbm/pktopbm.c
---- netpbm-10.58.01/converter/pbm/pktopbm.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/pktopbm.c 2012-04-09 15:40:03.198619851 +0200
-@@ -277,6 +277,7 @@ main(int argc, char *argv[]) {
- if (flagbyte == 7) { /* long form preamble */
- integer packetlength = get32() ; /* character packet length */
- car = get32() ; /* character number */
-+ overflow_add(packetlength, pktopbm_pkloc);
- endofpacket = packetlength + pktopbm_pkloc;
- /* calculate end of packet */
- if ((car >= MAXPKCHAR) || !filename[car]) {
-diff -up netpbm-10.58.01/converter/pbm/thinkjettopbm.l.security-code netpbm-10.58.01/converter/pbm/thinkjettopbm.l
---- netpbm-10.58.01/converter/pbm/thinkjettopbm.l.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/thinkjettopbm.l 2012-04-09 15:40:03.199619839 +0200
-@@ -114,7 +114,9 @@ DIG [0-9]
- \033\*b{DIG}+W {
- int l;
+ *cheightP = cheight;
+diff -urNp a/converter/pbm/thinkjettopbm.l b/converter/pbm/thinkjettopbm.l
+--- a/converter/pbm/thinkjettopbm.l 2025-02-03 09:24:28.359500407 +0100
++++ b/converter/pbm/thinkjettopbm.l 2025-02-03 17:11:07.302725005 +0100
+@@ -117,6 +117,7 @@ DIG [0-9]
if (rowCount >= rowCapacity) {
-+ overflow_add(rowCapacity, 100);
+ if (rowCapacity > INT_MAX-100)
+ pm_error("Too many rows to count");
++ overflow_add(rowCapacity, 100);
rowCapacity += 100;
-+ overflow2(rowCapacity, sizeof *rows);
- rows = realloc (rows, rowCapacity * sizeof *rows);
+ REALLOCARRAY(rows, rowCapacity);
if (rows == NULL)
- pm_error ("Out of memory.");
-@@ -226,6 +228,8 @@ yywrap (void)
+@@ -232,6 +233,7 @@ yywrap (void)
/*
* Quite simple since ThinkJet bit arrangement matches PBM
*/
-+
+ overflow2(maxRowLength, 8);
pbm_writepbminit(stdout, maxRowLength*8, rowCount, 0);
packed_bitrow = malloc(maxRowLength);
-diff -up netpbm-10.58.01/converter/pbm/ybmtopbm.c.security-code netpbm-10.58.01/converter/pbm/ybmtopbm.c
---- netpbm-10.58.01/converter/pbm/ybmtopbm.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/converter/pbm/ybmtopbm.c 2012-04-09 15:40:03.199619839 +0200
-@@ -49,6 +49,7 @@ getinit(FILE * const ifP,
- pm_error("EOF / read error");
+diff -urNp a/converter/pbm/ybmtopbm.c b/converter/pbm/ybmtopbm.c
+--- a/converter/pbm/ybmtopbm.c 2025-02-03 09:24:28.359500407 +0100
++++ b/converter/pbm/ybmtopbm.c 2025-02-03 17:17:57.638369880 +0100
+@@ -88,8 +88,12 @@ main(int argc, const char * argv[]) {
- *depthP = 1;
-+ overflow_add(*colsP, 15);
- *padrightP = ((*colsP + 15) / 16) * 16 - *colsP;
- }
+ pbm_writepbminit(stdout, cols, rows, 0);
-diff -up netpbm-10.58.01/converter/pgm/lispmtopgm.c.security-code netpbm-10.58.01/converter/pgm/lispmtopgm.c
---- netpbm-10.58.01/converter/pgm/lispmtopgm.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/pgm/lispmtopgm.c 2012-04-09 15:40:03.199619839 +0200
-@@ -58,6 +58,7 @@ main( argc, argv )
- pm_error( "depth (%d bits) is too large", depth);
-
- pgm_writepgminit( stdout, cols, rows, (gray) maxval, 0 );
-+ overflow_add(cols, 7);
- grayrow = pgm_allocrow( ( cols + 7 ) / 8 * 8 );
-
- for ( row = 0; row < rows; ++row )
-@@ -102,7 +103,9 @@ getinit( file, colsP, rowsP, depthP, pad
-
- if ( *depthP == 0 )
- *depthP = 1; /* very old file */
--
++ overflow_add(cols, 8);
+
-+ overflow_add((int)colsP, 31);
-+
- *padrightP = ( ( *colsP + 31 ) / 32 ) * 32 - *colsP;
-
- if ( *colsP != (cols_32 - *padrightP) ) {
-diff -up netpbm-10.58.01/converter/pgm/psidtopgm.c.security-code netpbm-10.58.01/converter/pgm/psidtopgm.c
---- netpbm-10.58.01/converter/pgm/psidtopgm.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/pgm/psidtopgm.c 2012-04-09 15:40:03.200619827 +0200
-@@ -78,6 +78,7 @@ main(int argc,
- pm_error("bits/sample (%d) is too large.", bitspersample);
+ bitrow = pbm_allocrow_packed(cols + 8);
- pgm_writepgminit(stdout, cols, rows, maxval, 0);
-+ overflow_add(cols, 7);
- grayrow = pgm_allocrow((cols + 7) / 8 * 8);
- for (row = 0; row < rows; ++row) {
- unsigned int col;
-diff -up netpbm-10.58.01/converter/ppm/ilbmtoppm.c.security-code netpbm-10.58.01/converter/ppm/ilbmtoppm.c
---- netpbm-10.58.01/converter/ppm/ilbmtoppm.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/ilbmtoppm.c 2012-04-09 15:40:03.201619815 +0200
-@@ -592,6 +592,7 @@ decode_row(FILE * const ifP,
- rawtype *chp;
-
- cols = bmhdP->w;
+ overflow_add(cols, 15);
- bytes = RowBytes(cols);
- for( plane = 0; plane < nPlanes; plane++ ) {
- int mask;
-@@ -679,6 +680,23 @@ decode_mask(FILE * const ifP,
- Multipalette handling
- ****************************************************************************/
++
+ for (row = 0; row < rows; ++row) {
+ uint16_t * const itemrow = (uint16_t *) bitrow;
+ unsigned int const itemCt = (cols + 15) / 16;
+diff -urNp a/converter/ppm/ilbmtoppm.c b/converter/ppm/ilbmtoppm.c
+--- a/converter/ppm/ilbmtoppm.c 2025-02-03 09:24:28.330500563 +0100
++++ b/converter/ppm/ilbmtoppm.c 2025-02-03 18:06:05.606638402 +0100
+@@ -1385,6 +1385,9 @@ dcol_to_ppm(FILE * const ifP,
+ if (redmaxval != maxval || greenmaxval != maxval || bluemaxval != maxval)
+ pm_message("scaling colors to %u bits", pm_maxvaltobits(maxval));
-+static void *
-+xmalloc2(x, y)
-+ int x;
-+ int y;
-+{
-+ void *mem;
-+
-+ overflow2(x,y);
-+ if( x * y == 0 )
-+ return NULL;
-+
-+ mem = malloc2(x,y);
-+ if( mem == NULL )
-+ pm_error("out of memory allocating %d bytes", x * y);
-+ return mem;
-+}
-+
-
- static void
- multi_adjust(cmap, row, palchange)
-@@ -1341,6 +1359,9 @@ dcol_to_ppm(FILE * const ifP,
- if( redmaxval != maxval || greenmaxval != maxval || bluemaxval != maxval )
- pm_message("scaling colors to %d bits", pm_maxvaltobits(maxval));
-
+ overflow_add(redmaxval, 1);
+ overflow_add(greenmaxval, 1);
+ overflow_add(bluemaxval, 1);
- MALLOCARRAY_NOFAIL(redtable, redmaxval +1);
- MALLOCARRAY_NOFAIL(greentable, greenmaxval +1);
- MALLOCARRAY_NOFAIL(bluetable, bluemaxval +1);
-@@ -1763,7 +1784,9 @@ PCHG_ConvertSmall(PCHG, cmap, mask, data
- ChangeCount32 = *data++;
- datasize -= 2;
+ MALLOCARRAY_NOFAIL(redtable, redmaxval + 1);
+ MALLOCARRAY_NOFAIL(greentable, greenmaxval + 1);
+ MALLOCARRAY_NOFAIL(bluetable, bluemaxval + 1);
+@@ -1875,12 +1878,14 @@ PCHG_ConvertSmall(PCHGHeader * const
+ else {
+ unsigned int const changeCt16 = *dataCursor++;
+ unsigned int const changeCt32 = *dataCursor++;
++ overflow_add(changeCt16, changeCt32);
+ unsigned int const changeCt = changeCt16 + changeCt32;
-+ overflow_add(ChangeCount16, ChangeCount32);
- changes = ChangeCount16 + ChangeCount32;
-+ overflow_add(changes, 1);
- for( i = 0; i < changes; i++ ) {
- if( totalchanges >= PCHG->TotalChanges ) goto fail;
- if( datasize < 2 ) goto fail;
-@@ -2028,6 +2051,9 @@ read_pchg(FILE * const ifp,
- cmap->mp_change[i] = NULL;
- if( PCHG.StartLine < 0 ) {
- int nch;
-+ if(PCHG.MaxReg < PCHG.MinReg)
-+ pm_error("assert: MinReg > MaxReg");
-+ overflow_add(PCHG.MaxReg-PCHG.MinReg, 2);
- nch = PCHG.MaxReg - PCHG.MinReg +1;
- MALLOCARRAY_NOFAIL(cmap->mp_init, nch + 1);
- for( i = 0; i < nch; i++ )
-@@ -2104,6 +2130,7 @@ process_body( FILE * const ifp,
- if( typeid == ID_ILBM ) {
- int isdeep;
+ unsigned int i;
-+ overflow_add(bmhdP->w, 15);
- MALLOCARRAY_NOFAIL(ilbmrow, RowBytes(bmhdP->w));
- *viewportmodesP |= fakeviewport; /* -isham/-isehb */
+ remDataSize -= 2;
-diff -up netpbm-10.58.01/converter/ppm/imgtoppm.c.security-code netpbm-10.58.01/converter/ppm/imgtoppm.c
---- netpbm-10.58.01/converter/ppm/imgtoppm.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/imgtoppm.c 2012-04-09 15:40:03.202619802 +0200
-@@ -84,6 +84,7 @@ main(int argc, char ** argv) {
- len = atoi((char*) buf );
- if ( fread( buf, len, 1, ifp ) != 1 )
- pm_error( "bad colormap buf" );
++ overflow_add(changeCt, 1);
+ MALLOCARRAY_NOFAIL(cmapP->mp_change[row], changeCt + 1);
+ for (i = 0; i < changeCt; ++i) {
+ if (totalChangeCt >= pchgP->TotalChanges) goto fail;
+@@ -2122,6 +2127,7 @@ read_pchg(FILE * const ifP,
+ "is less than minreg (%u)",
+ PCHG.MaxReg, PCHG.MinReg);
+ else {
++ overflow_add(PCHG.MaxReg-PCHG.MinReg, 2);
+ unsigned int const nch = PCHG.MaxReg - PCHG.MinReg + 1;
+
+ unsigned int i;
+diff -urNp a/converter/ppm/imgtoppm.c b/converter/ppm/imgtoppm.c
+--- a/converter/ppm/imgtoppm.c 2025-02-03 09:24:28.330500563 +0100
++++ b/converter/ppm/imgtoppm.c 2025-02-03 18:10:34.478961449 +0100
+@@ -85,6 +85,7 @@ main(int argc, const char ** argv) {
+ len = atoi((char*) buf);
+ if (fread(buf, len, 1, ifP) != 1)
+ pm_error("bad colormap buf");
+ overflow2(cmaplen, 3);
- if ( cmaplen * 3 != len )
- {
+ if (len != cmaplen * 3) {
pm_message(
-@@ -105,6 +106,7 @@ main(int argc, char ** argv) {
- pm_error( "bad pixel data header" );
+ "cmaplen (%u) and colormap buf length (%u) do not match",
+@@ -105,6 +106,7 @@ main(int argc, const char ** argv) {
+ pm_error("bad pixel data header");
buf[8] = '\0';
- len = atoi((char*) buf );
+ len = atoi((char*) buf);
+ overflow2(cols, rows);
- if ( len != cols * rows )
+ if (len != cols * rows)
pm_message(
- "pixel data length (%d) does not match image size (%d)",
-diff -up netpbm-10.58.01/converter/ppm/Makefile.security-code netpbm-10.58.01/converter/ppm/Makefile
---- netpbm-10.58.01/converter/ppm/Makefile.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/Makefile 2012-04-09 15:40:03.202619802 +0200
+ "pixel data length (%u) does not match image size (%u)",
+diff -urNp a/converter/ppm/Makefile b/converter/ppm/Makefile
+--- a/converter/ppm/Makefile 2025-02-03 09:24:28.331500558 +0100
++++ b/converter/ppm/Makefile 2025-02-03 17:39:13.338685028 +0100
@@ -11,7 +11,7 @@ SUBDIRS = hpcdtoppm ppmtompeg
PORTBINARIES = 411toppm eyuvtoppm gouldtoppm ilbmtoppm imgtoppm \
@@ -575,126 +387,84 @@ diff -up netpbm-10.58.01/converter/ppm/Makefile.security-code netpbm-10.58.01/co
ppmtoacad ppmtoapplevol ppmtoarbtxt ppmtoascii \
ppmtobmp ppmtoeyuv ppmtogif ppmtoicr ppmtoilbm \
ppmtoleaf ppmtolj ppmtomitsu ppmtoneo \
-diff -up netpbm-10.58.01/converter/ppm/pcxtoppm.c.security-code netpbm-10.58.01/converter/ppm/pcxtoppm.c
---- netpbm-10.58.01/converter/ppm/pcxtoppm.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/pcxtoppm.c 2012-04-09 15:40:03.203619789 +0200
-@@ -409,6 +409,7 @@ pcx_planes_to_pixels(pixels, bitplanes,
- /*
- * clear the pixel buffer
- */
-+ overflow2(bytesperline, 8);
- npixels = (bytesperline * 8) / bitsperpixel;
- p = pixels;
- while (--npixels >= 0)
-@@ -470,6 +471,7 @@ pcx_16col_to_ppm(FILE * const ifP,
- }
+diff -urNp a/converter/ppm/pcxtoppm.c b/converter/ppm/pcxtoppm.c
+--- a/converter/ppm/pcxtoppm.c 2025-02-03 09:24:28.329500569 +0100
++++ b/converter/ppm/pcxtoppm.c 2025-02-03 18:12:34.245400166 +0100
+@@ -378,6 +378,7 @@ pcxPlanesToPixels(unsigned char * const
+ to conceive how this subroutine should work with other numbers of bits per
+ sample, but it doesn't.
+ -----------------------------------------------------------------------------*/
++ overflow2(bytesPerLine, 8);
+ unsigned int const pixelCt = bytesPerLine * 8;
- /* BytesPerLine should be >= BitsPerPixel * cols / 8 */
-+ overflow2(BytesPerLine, 8);
- rawcols = BytesPerLine * 8 / BitsPerPixel;
- if (headerCols > rawcols) {
- pm_message("warning - BytesPerLine = %d, "
-diff -up netpbm-10.58.01/converter/ppm/picttoppm.c.security-code netpbm-10.58.01/converter/ppm/picttoppm.c
---- netpbm-10.58.01/converter/ppm/picttoppm.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/picttoppm.c 2012-04-09 15:40:03.205619763 +0200
-@@ -1,3 +1,5 @@
-+#error "Unfixable. Don't ship me"
-+
- /*
- * picttoppm.c -- convert a MacIntosh PICT file to PPM format.
- *
-diff -up netpbm-10.58.01/converter/ppm/pjtoppm.c.security-code netpbm-10.58.01/converter/ppm/pjtoppm.c
---- netpbm-10.58.01/converter/ppm/pjtoppm.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/pjtoppm.c 2012-04-09 15:40:03.206619751 +0200
-@@ -127,19 +127,21 @@ main(argc, argv)
- case 'V': /* send plane */
- case 'W': /* send last plane */
- if (rows == -1 || r >= rows || image == NULL) {
-- if (rows == -1 || r >= rows)
-+ if (rows == -1 || r >= rows) {
-+ overflow_add(rows, 100);
- rows += 100;
-+ }
- if (image == NULL) {
-- MALLOCARRAY(image, rows * planes);
-- MALLOCARRAY(imlen, rows * planes);
-+ image = (unsigned char **)
-+ malloc3(rows , planes , sizeof(unsigned char *));
-+ imlen = (int *) malloc3(rows , planes, sizeof(int));
- }
- else {
-+ overflow2(rows,planes);
- image = (unsigned char **)
-- realloc(image,
-- rows * planes *
-+ realloc2(image, rows * planes,
- sizeof(unsigned char *));
-- imlen = (int *)
-- realloc(imlen, rows * planes * sizeof(int));
-+ imlen = (int *) realloc2(imlen, rows * planes, sizeof(int));
- }
- }
- if (image == NULL || imlen == NULL)
-@@ -212,8 +214,10 @@ main(argc, argv)
- for (i = 0, c = 0; c < imlen[p + r * planes]; c += 2)
- for (cmd = image[p + r * planes][c],
- val = image[p + r * planes][c+1];
-- cmd >= 0 && i < newcols; cmd--, i++)
-+ cmd >= 0 && i < newcols; cmd--, i++) {
+ unsigned int bitPlanesIdx;
+diff -urNp a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c
+--- a/converter/ppm/pjtoppm.c 2025-02-03 09:24:28.329500569 +0100
++++ b/converter/ppm/pjtoppm.c 2025-02-03 18:21:28.636228030 +0100
+@@ -77,6 +77,7 @@ modifyImageMode1(unsigned int const
+ val = image[plane + row * planes][col+1];
+ cmd >= 0 && i < newcols; --cmd, ++i)
buf[i] = val;
+ overflow_add(i, 1);
-+ }
- cols = cols > i ? cols : i;
- free(image[p + r * planes]);
- /*
-@@ -224,6 +228,7 @@ main(argc, argv)
- image[p + r * planes] = (unsigned char *) realloc(buf, i);
+ }
+ cols = MAX(cols, i);
+ free(image[row * planes + plane]);
+@@ -90,6 +91,7 @@ modifyImageMode1(unsigned int const
}
}
-+ overflow2(cols, 8);
- cols *= 8;
}
-
-diff -up netpbm-10.58.01/converter/ppm/ppmtoeyuv.c.security-code netpbm-10.58.01/converter/ppm/ppmtoeyuv.c
---- netpbm-10.58.01/converter/ppm/ppmtoeyuv.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/ppmtoeyuv.c 2012-04-09 15:40:03.206619751 +0200
-@@ -114,6 +114,7 @@ create_multiplication_tables(const pixva
++ overflow2(cols, 8);
+ *colsP = cols * 8; assert(cols < UINT_MAX/8);
+ }
- int index;
+@@ -265,8 +267,10 @@ main(int argc, const char ** argv) {
+ case 'V': /* send plane */
+ case 'W': /* send last plane */
+ if (row >= rowsX || image == NULL) {
+- if (row >= rowsX)
++ if (row >= rowsX) {
++ overflow_add(rows, 100);
+ rowsX += 100;
++ }
+ REALLOCARRAY(image, uintProduct(rowsX, planes));
+ REALLOCARRAY(imlen, uintProduct(rowsX, planes));
+ }
+@@ -277,6 +281,8 @@ main(int argc, const char ** argv) {
+ if (!colsIsSet)
+ pm_error("missing width value");
+
++ overflow2(rows,planes);
++ overflow_add(rows * planes, plane);
+ cols = MAX(cols, val);
+ imlen[row * planes + plane] = val;
+ MALLOCARRAY(image[row * planes + plane], val);
+diff -urNp a/converter/ppm/ppmtoeyuv.c b/converter/ppm/ppmtoeyuv.c
+--- a/converter/ppm/ppmtoeyuv.c 2025-02-03 09:24:28.330500563 +0100
++++ b/converter/ppm/ppmtoeyuv.c 2025-02-03 18:22:08.012087384 +0100
+@@ -117,6 +117,7 @@ chrominanceBlue(pixel const p) {
+ static void
+ createMultiplicationTables(pixval const maxval) {
+ overflow_add(maxval, 1);
MALLOCARRAY_NOFAIL(mult299 , maxval+1);
MALLOCARRAY_NOFAIL(mult587 , maxval+1);
MALLOCARRAY_NOFAIL(mult114 , maxval+1);
-diff -up netpbm-10.58.01/converter/ppm/ppmtoicr.c.security-code netpbm-10.58.01/converter/ppm/ppmtoicr.c
---- netpbm-10.58.01/converter/ppm/ppmtoicr.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/ppmtoicr.c 2012-04-09 15:40:03.207619739 +0200
-@@ -169,7 +169,7 @@ char* argv[];
+diff -urNp a/converter/ppm/ppmtolj.c b/converter/ppm/ppmtolj.c
+--- a/converter/ppm/ppmtolj.c 2025-02-03 09:24:28.330500563 +0100
++++ b/converter/ppm/ppmtolj.c 2025-02-03 18:24:55.523489226 +0100
+@@ -212,6 +212,8 @@ printRaster(FILE * const ifP,
+ pm_error("Image is uncomputably wide (%u columns)", cols);
+ }
- if (rleflag) {
- pm_message("sending run-length encoded picture data ..." );
-- testimage = (char*) malloc(rows*cols);
-+ testimage = (char*) malloc2(rows, cols);
- p = testimage;
- for (i=0; i PCL_MAXVAL)
pm_error("color range too large; reduce with ppmcscale");
+ if (cols < 0 || rows < 0)
+ pm_error("negative size is not possible");
- /* Figure out the colormap. */
- pm_message("Computing colormap...");
-@@ -296,6 +298,8 @@ main(int argc, const char * argv[]) {
- case 0: /* direct mode (no palette) */
- bpp = bitsperpixel(maxval); /* bits per pixel */
- bpg = bpp; bpb = bpp;
-+ overflow2(bpp, 3);
-+ overflow_add(bpp*3, 7);
- bpp = (bpp*3+7)>>3; /* bytes per pixel now */
- bpr = (bpp<<3)-bpg-bpb;
- bpp *= cols; /* bytes per row now */
-@@ -305,9 +309,13 @@ main(int argc, const char * argv[]) {
- case 3: case 7: pclindex++;
- default:
- bpp = 8/pclindex;
-+ overflow_add(cols, bpp);
-+ if(bpp == 0)
-+ pm_error("assert: no bpp");
- bpp = (cols+bpp-1)/bpp; /* bytes per row */
- }
- }
-+ overflow2(bpp,2);
- inrow = (char *)malloc((unsigned)bpp);
- outrow = (char *)malloc((unsigned)bpp*2);
- runcnt = (signed char *)malloc((unsigned)bpp);
-diff -up netpbm-10.58.01/converter/ppm/ppmtowinicon.c.security-code netpbm-10.58.01/converter/ppm/ppmtowinicon.c
---- netpbm-10.58.01/converter/ppm/ppmtowinicon.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/ppmtowinicon.c 2012-04-09 15:40:03.213619664 +0200
-@@ -12,6 +12,7 @@
+ computeColormap(pixels, cols, rows, MAXCOLORS, &chv, &cht, &colorCt);
+diff -urNp a/converter/ppm/ppmtowinicon.c b/converter/ppm/ppmtowinicon.c
+--- a/converter/ppm/ppmtowinicon.c 2025-02-03 09:24:28.330500563 +0100
++++ b/converter/ppm/ppmtowinicon.c 2025-02-03 18:56:25.509890831 +0100
+@@ -14,6 +14,7 @@
+ #include
#include
#include
+#include
#include "pm_c_util.h"
#include "winico.h"
-@@ -219,6 +220,7 @@ createAndBitmap (gray ** const ba, int c
- MALLOCARRAY_NOFAIL(rowData, rows);
- icBitmap->xBytes = xBytes;
- icBitmap->data = rowData;
-+ overflow2(xBytes, rows);
- icBitmap->size = xBytes * rows;
- for (y=0;yxBytes = xBytes;
- icBitmap->data = rowData;
-+ overflow2(xBytes, rows);
- icBitmap->size = xBytes * rows;
-
- for (y=0;yxBytes = xBytes;
- icBitmap->data = rowData;
-+ overflow2(xBytes, rows);
- icBitmap->size = xBytes * rows;
-
- for (y=0;ybitcount = bpp;
- entry->ih = createInfoHeader(entry, xorBitmap, andBitmap);
- entry->colors = palette->colors;
-+ overflow2(4, entry->color_count);
-+ overflow_add(xorBitmap->size, andBitmap->size);
-+ overflow_add(xorBitmap->size + andBitmap->size, 40);
-+ overflow_add(xorBitmap->size + andBitmap->size + 40, 4 * entry->color_count);
- entry->size_in_bytes =
- xorBitmap->size + andBitmap->size + 40 + (4 * entry->color_count);
- if (verbose)
-diff -up netpbm-10.58.01/converter/ppm/ppmtoxpm.c.security-code netpbm-10.58.01/converter/ppm/ppmtoxpm.c
---- netpbm-10.58.01/converter/ppm/ppmtoxpm.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/ppmtoxpm.c 2012-04-09 15:40:03.214619651 +0200
-@@ -197,6 +197,7 @@ genNumstr(unsigned int const input, int
+@@ -207,6 +208,7 @@ newAndBitmap(gray ** const ba,
+ MALLOCARRAY_NOFAIL(rowData, rows);
+ icBitmapP->xBytes = xByteCt;
+ icBitmapP->data = rowData;
++ overflow2(xByteCt, rows);
+ icBitmapP->size = xByteCt * rows;
+ for (row = 0; row < rows; ++row) {
+ u1 * thisRow; /* malloc'ed */
+@@ -706,6 +708,11 @@ addEntryToIcon(MS_Ico * const MSIcon
+ /* all the icons I looked at ignored this value */
+ entryP->ih = newInfoHeader(*entryP);
+ entryP->colors = paletteP->colors;
++ overflow2(4, entryCols);
++ overflow_add(xorBitmapP->size, andBitmapP->size);
++ overflow_add(xorBitmapP->size + andBitmapP->size, 40);
++ overflow_add(xorBitmapP->size + andBitmapP->size + 40, 4 * entryCols);
++
+ entryP->size_in_bytes =
+ xorBitmapP->size + andBitmapP->size + 40 + (4 * entryCols);
+ if (verbose)
+diff -urNp a/converter/ppm/ppmtoxpm.c b/converter/ppm/ppmtoxpm.c
+--- a/converter/ppm/ppmtoxpm.c 2025-02-03 09:24:28.329500569 +0100
++++ b/converter/ppm/ppmtoxpm.c 2025-02-03 18:59:21.646266347 +0100
+@@ -193,6 +193,7 @@ numstr(unsigned int const input,
unsigned int i;
/* Allocate memory for printed number. Abort if error. */
-+ overflow_add(digits, 1);
- if (!(str = (char *) malloc(digits + 1)))
- pm_error("out of memory");
++ overflow_add(digitCt, 1);
+ MALLOCARRAY_NOFAIL(str, digitCt + 1);
-@@ -314,6 +315,7 @@ genCmap(colorhist_vector const chv,
- unsigned int charsPerPixel;
- unsigned int xpmMaxval;
-
+ i = input; /* initial value */
+@@ -296,6 +297,7 @@ genCmap(colorhist_vector const chv,
+ Return as *charsPerPixel the number of characters, or digits, that
+ will be needed in the XPM raster to form an index into this color map.
+ -----------------------------------------------------------------------------*/
+ if (includeTransparent) overflow_add(ncolors, 1);
- MALLOCARRAY(cmap, cmapSize);
- if (cmapP == NULL)
- pm_error("Out of memory allocating %u bytes for a color map.",
-diff -up netpbm-10.58.01/converter/ppm/qrttoppm.c.security-code netpbm-10.58.01/converter/ppm/qrttoppm.c
---- netpbm-10.58.01/converter/ppm/qrttoppm.c.security-code 2012-04-09 15:31:42.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/qrttoppm.c 2012-04-09 15:40:03.215619638 +0200
-@@ -46,7 +46,7 @@ main( argc, argv )
+ unsigned int const cmapSize = ncolors + (includeTransparent ? 1 : 0);
- ppm_writeppminit( stdout, cols, rows, maxval, 0 );
- pixelrow = ppm_allocrow( cols );
-- buf = (unsigned char *) malloc( 3 * cols );
-+ buf = (unsigned char *) malloc2( 3 , cols );
- if ( buf == (unsigned char *) 0 )
- pm_error( "out of memory" );
+ CixelMap * cmap; /* malloc'ed */
+diff -urNp a/converter/ppm/qrttoppm.c b/converter/ppm/qrttoppm.c
+--- a/converter/ppm/qrttoppm.c 2025-02-03 09:24:28.331500558 +0100
++++ b/converter/ppm/qrttoppm.c 2025-02-03 19:00:16.846070585 +0100
+@@ -51,6 +51,7 @@ main(int argc, const char ** argv) {
+
+ pixelrow = ppm_allocrow(cols);
+
++ overflow2(cols, 3);
+ MALLOCARRAY(buf, 3 * cols);
+
+ if (!buf)
+diff -urNp a/converter/ppm/sldtoppm.c b/converter/ppm/sldtoppm.c
+--- a/converter/ppm/sldtoppm.c 2025-02-03 09:24:28.330500563 +0100
++++ b/converter/ppm/sldtoppm.c 2025-02-03 19:02:13.580656717 +0100
+@@ -542,6 +542,8 @@ slider(slvecfn slvec,
-diff -up netpbm-10.58.01/converter/ppm/sldtoppm.c.security-code netpbm-10.58.01/converter/ppm/sldtoppm.c
---- netpbm-10.58.01/converter/ppm/sldtoppm.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/sldtoppm.c 2012-04-09 15:40:03.216619626 +0200
-@@ -455,6 +455,8 @@ slider(slvecfn slvec,
-
/* Allocate image buffer and clear it to black. */
-
-+ overflow_add(ixdots,1);
-+ overflow_add(iydots,1);
- pixels = ppm_allocarray(pixcols = ixdots + 1, pixrows = iydots + 1);
- PPM_ASSIGN(rgbcolor, 0, 0, 0);
- ppmd_filledrectangle(pixels, pixcols, pixrows, pixmaxval, 0, 0,
-diff -up netpbm-10.58.01/converter/ppm/ximtoppm.c.security-code netpbm-10.58.01/converter/ppm/ximtoppm.c
---- netpbm-10.58.01/converter/ppm/ximtoppm.c.security-code 2012-04-09 15:31:44.000000000 +0200
-+++ netpbm-10.58.01/converter/ppm/ximtoppm.c 2012-04-09 15:40:03.216619626 +0200
-@@ -117,6 +117,7 @@ ReadXimHeader(FILE * const in_fp,
- header->bits_channel = atoi(a_head.bits_per_channel);
- header->alpha_flag = atoi(a_head.alpha_channel);
- if (strlen(a_head.author)) {
-+ overflow_add(strlen(a_head.author),1);
- if (!(header->author = calloc((unsigned int)strlen(a_head.author)+1,
- 1))) {
- pm_message("ReadXimHeader: can't calloc author string" );
-@@ -126,6 +127,7 @@ ReadXimHeader(FILE * const in_fp,
- strncpy(header->author, a_head.author, strlen(a_head.author));
- }
- if (strlen(a_head.date)) {
-+ overflow_add(strlen(a_head.date),1);
- if (!(header->date =calloc((unsigned int)strlen(a_head.date)+1,1))){
- pm_message("ReadXimHeader: can't calloc date string" );
- return(0);
-@@ -134,6 +136,7 @@ ReadXimHeader(FILE * const in_fp,
- strncpy(header->date, a_head.date, strlen(a_head.date));
- }
- if (strlen(a_head.program)) {
-+ overflow_add(strlen(a_head.program),1);
- if (!(header->program = calloc(
- (unsigned int)strlen(a_head.program) + 1, 1))) {
- pm_message("ReadXimHeader: can't calloc program string" );
-@@ -160,6 +163,7 @@ ReadXimHeader(FILE * const in_fp,
- if (header->nchannels == 3 && header->bits_channel == 8)
- header->ncolors = 0;
- else if (header->nchannels == 1 && header->bits_channel == 8) {
-+ overflow2(header->ncolors, sizeof(Color));
- header->colors = (Color *)calloc((unsigned int)header->ncolors,
- sizeof(Color));
- if (header->colors == NULL) {
-diff -up netpbm-10.58.01/editor/pamcut.c.security-code netpbm-10.58.01/editor/pamcut.c
---- netpbm-10.58.01/editor/pamcut.c.security-code 2012-04-09 15:31:33.000000000 +0200
-+++ netpbm-10.58.01/editor/pamcut.c 2012-04-09 15:40:03.218619602 +0200
-@@ -655,6 +655,8 @@ cutOneImage(FILE * const ifP
- outpam = inpam; /* Initial value -- most fields should be same */
- outpam.file = ofP;
-+ overflow_add(rightcol, 1);
-+ overflow_add(bottomrow, 1);
- outpam.width = rightcol - leftcol + 1;
- outpam.height = bottomrow - toprow + 1;
++ overflow_add(ixdots, 1);
++ overflow_add(iydots, 1);
+ pixcols = ixdots + 1;
+ pixrows = iydots + 1;
+ pixels = ppm_allocarray(pixcols, pixrows);
+diff -urNp a/converter/ppm/ximtoppm.c b/converter/ppm/ximtoppm.c
+--- a/converter/ppm/ximtoppm.c 2025-02-03 09:24:28.330500563 +0100
++++ b/converter/ppm/ximtoppm.c 2025-02-03 19:06:57.979648387 +0100
+@@ -204,8 +204,7 @@ readImageChannel(FILE * const if
+ }
+ /* return to the beginning of the next image's buffer */
+ if (fseek(ifP, marker, 0) == -1) {
+- pm_message("ReadImageChannel: can't fseek to location "
+- "in image buffer");
++ pm_message("ReadImageChannel: can't fseek to location in image buffer");
+ return 0;
+ }
+ free(line);
+diff -urNp a/editor/pamcut.c b/editor/pamcut.c
+--- a/editor/pamcut.c 2025-02-03 09:24:28.296500747 +0100
++++ b/editor/pamcut.c 2025-02-04 09:20:22.743237833 +0100
+@@ -833,6 +833,8 @@ cutOneImage(FILE * const ifP
+ } else {
+ outpam = inpam; /* Initial value -- most fields should be same */
+ outpam.file = ofP;
++ overflow_add(rightcol, 1);
++ overflow_add(bottomrow, 1);
+ outpam.width = rightcol - leftcol + 1;
+ outpam.height = bottomrow - toprow + 1;
-diff -up netpbm-10.58.01/editor/pbmreduce.c.security-code netpbm-10.58.01/editor/pbmreduce.c
---- netpbm-10.58.01/editor/pbmreduce.c.security-code 2012-04-09 15:31:33.000000000 +0200
-+++ netpbm-10.58.01/editor/pbmreduce.c 2012-04-09 15:40:03.219619590 +0200
-@@ -94,6 +94,7 @@ main( argc, argv )
- if (halftone == QT_FS) {
- unsigned int col;
- /* Initialize Floyd-Steinberg. */
-+ overflow_add(newcols, 2);
- MALLOCARRAY(thiserr, newcols + 2);
- MALLOCARRAY(nexterr, newcols + 2);
- if (thiserr == NULL || nexterr == NULL)
-diff -up netpbm-10.58.01/editor/pnmgamma.c.security-code netpbm-10.58.01/editor/pnmgamma.c
---- netpbm-10.58.01/editor/pnmgamma.c.security-code 2012-04-09 15:31:34.000000000 +0200
-+++ netpbm-10.58.01/editor/pnmgamma.c 2012-04-09 15:40:03.220619577 +0200
-@@ -586,6 +586,7 @@ createGammaTables(enum transferFunction
+diff -urNp a/editor/pnmgamma.c b/editor/pnmgamma.c
+--- a/editor/pnmgamma.c 2025-02-03 09:24:28.296500747 +0100
++++ b/editor/pnmgamma.c 2025-02-04 09:21:03.587045507 +0100
+@@ -596,6 +596,7 @@ createGammaTables(enum transferFunction
xelval ** const btableP) {
/* Allocate space for the tables. */
@@ -931,10 +619,10 @@ diff -up netpbm-10.58.01/editor/pnmgamma.c.security-code netpbm-10.58.01/editor/
MALLOCARRAY(*rtableP, maxval+1);
MALLOCARRAY(*gtableP, maxval+1);
MALLOCARRAY(*btableP, maxval+1);
-diff -up netpbm-10.58.01/editor/pnmhisteq.c.security-code netpbm-10.58.01/editor/pnmhisteq.c
---- netpbm-10.58.01/editor/pnmhisteq.c.security-code 2012-04-09 15:31:33.000000000 +0200
-+++ netpbm-10.58.01/editor/pnmhisteq.c 2012-04-09 15:40:03.220619577 +0200
-@@ -103,6 +103,7 @@ computeLuminosityHistogram(xel * const *
+diff -urNp a/editor/pnmhisteq.c b/editor/pnmhisteq.c
+--- a/editor/pnmhisteq.c 2025-02-03 09:24:28.296500747 +0100
++++ b/editor/pnmhisteq.c 2025-02-04 09:21:41.957864812 +0100
+@@ -106,6 +106,7 @@ computeLuminosityHistogram(xel * const *
unsigned int pixelCount;
unsigned int * lumahist;
@@ -942,22 +630,10 @@ diff -up netpbm-10.58.01/editor/pnmhisteq.c.security-code netpbm-10.58.01/editor
MALLOCARRAY(lumahist, maxval + 1);
if (lumahist == NULL)
pm_error("Out of storage allocating array for %u histogram elements",
-diff -up netpbm-10.58.01/editor/pnmindex.csh.security-code netpbm-10.58.01/editor/pnmindex.csh
---- netpbm-10.58.01/editor/pnmindex.csh.security-code 2012-04-09 15:31:33.000000000 +0200
-+++ netpbm-10.58.01/editor/pnmindex.csh 2012-04-09 15:40:03.221619564 +0200
-@@ -1,5 +1,8 @@
- #!/bin/csh -f
- #
-+echo "Unsafe code, needs debugging, do not ship"
-+exit 1
-+#
- # pnmindex - build a visual index of a bunch of anymaps
- #
- # Copyright (C) 1991 by Jef Poskanzer.
-diff -up netpbm-10.58.01/editor/pnmpad.c.security-code netpbm-10.58.01/editor/pnmpad.c
---- netpbm-10.58.01/editor/pnmpad.c.security-code 2012-04-09 15:31:34.000000000 +0200
-+++ netpbm-10.58.01/editor/pnmpad.c 2012-04-09 15:40:03.221619564 +0200
-@@ -527,6 +527,8 @@ main(int argc, const char ** argv) {
+diff -urNp a/editor/pnmpad.c b/editor/pnmpad.c
+--- a/editor/pnmpad.c 2025-02-03 09:24:28.299500730 +0100
++++ b/editor/pnmpad.c 2025-02-04 09:22:39.237595043 +0100
+@@ -1127,6 +1127,8 @@ main(int argc, const char ** argv) {
computePadSizes(cmdline, cols, rows, &lpad, &rpad, &tpad, &bpad);
@@ -965,219 +641,153 @@ diff -up netpbm-10.58.01/editor/pnmpad.c.security-code netpbm-10.58.01/editor/pn
+ overflow_add(cols + lpad, rpad);
newcols = cols + lpad + rpad;
- if (PNM_FORMAT_TYPE(format) == PBM_TYPE)
-diff -up netpbm-10.58.01/editor/pnmremap.c.security-code netpbm-10.58.01/editor/pnmremap.c
---- netpbm-10.58.01/editor/pnmremap.c.security-code 2012-04-09 15:31:33.000000000 +0200
-+++ netpbm-10.58.01/editor/pnmremap.c 2012-04-09 15:40:03.222619551 +0200
-@@ -409,7 +409,7 @@ initFserr(struct pam * const pamP,
+ if (cmdline.reportonly)
+diff -urNp a/editor/pnmremap.c b/editor/pnmremap.c
+--- a/editor/pnmremap.c 2025-02-03 09:24:28.296500747 +0100
++++ b/editor/pnmremap.c 2025-02-04 09:42:44.340919042 +0100
+@@ -468,6 +468,7 @@ fserr_init(struct pam * const pamP,
+ -----------------------------------------------------------------------------*/
unsigned int plane;
- unsigned int const fserrSize = pamP->width + 2;
--
+ overflow_add(pamP->width, 2);
+ unsigned int const fserrSz = pamP->width + 2;
+
fserrP->width = pamP->width;
+@@ -508,6 +509,7 @@ floydInitRow(struct pam * const pamP,
- MALLOCARRAY(fserrP->thiserr, pamP->depth);
-@@ -445,6 +445,7 @@ floydInitRow(struct pam * const pamP, st
+ unsigned int col;
- int col;
-
+ overflow_add(pamP->width, 2);
for (col = 0; col < pamP->width + 2; ++col) {
unsigned int plane;
- for (plane = 0; plane < pamP->depth; ++plane)
-diff -up netpbm-10.58.01/editor/pnmscalefixed.c.security-code netpbm-10.58.01/editor/pnmscalefixed.c
---- netpbm-10.58.01/editor/pnmscalefixed.c.security-code 2012-04-09 15:31:34.000000000 +0200
-+++ netpbm-10.58.01/editor/pnmscalefixed.c 2012-04-09 15:40:03.223619538 +0200
-@@ -214,6 +214,8 @@ compute_output_dimensions(const struct c
+ for (plane = 0; plane < pamP->depth; ++plane)
+diff -urNp a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c
+--- a/editor/pnmscalefixed.c 2025-02-03 09:24:28.299500730 +0100
++++ b/editor/pnmscalefixed.c 2025-02-04 09:49:53.152275133 +0100
+@@ -215,6 +215,7 @@ compute_output_dimensions(const struct c
const int rows, const int cols,
int * newrowsP, int * newcolsP) {
+ overflow2(rows, cols);
-+
if (cmdline.pixels) {
- if (rows * cols <= cmdline.pixels) {
+ if (rows <= cmdline.pixels / cols) {
*newrowsP = rows;
-@@ -265,6 +267,8 @@ compute_output_dimensions(const struct c
-
- if (*newcolsP < 1) *newcolsP = 1;
- if (*newrowsP < 1) *newrowsP = 1;
-+
-+ overflow2(*newcolsP, *newrowsP);
- }
-
-
-@@ -446,6 +450,9 @@ main(int argc, char **argv ) {
- unfilled. We can address that by stretching, whereas the other
- case would require throwing away some of the input.
- */
-+
+@@ -222,6 +223,8 @@ compute_output_dimensions(const struct c
+ } else {
+ const double scale =
+ sqrt( (float) cmdline.pixels / ((float) cols * (float) rows));
++ overflow2(rows, scale);
++ overflow2(scale, cols);
+ *newrowsP = rows * scale;
+ *newcolsP = cols * scale;
+ }
+@@ -455,6 +458,9 @@ main(int argc, char **argv ) {
+ pm_error("New image width (%d) is uncomputably large", newcols);
+ if (newrows > INT_MAX / SCALE)
+ pm_error("New image height (%d) is uncomputably large", newrows);
++
+ overflow2(newcols, SCALE);
+ overflow2(newrows, SCALE);
sxscale = SCALE * newcols / cols;
syscale = SCALE * newrows / rows;
-diff -up netpbm-10.58.01/editor/ppmdither.c.security-code netpbm-10.58.01/editor/ppmdither.c
---- netpbm-10.58.01/editor/ppmdither.c.security-code 2012-04-09 15:31:33.000000000 +0200
-+++ netpbm-10.58.01/editor/ppmdither.c 2012-04-09 15:40:03.224619526 +0200
-@@ -355,7 +355,11 @@ dithMatrix(unsigned int const dithPower)
- unsigned int const dithMatSize =
- (dithDim * sizeof(*dithMat)) + /* pointers */
- (dithDim * dithDim * sizeof(**dithMat)); /* data */
--
-+
-+ overflow2(dithDim, sizeof(*dithMat));
-+ overflow3(dithDim, dithDim, sizeof(**dithMat));
-+ overflow_add(dithDim * sizeof(*dithMat), dithDim * dithDim * sizeof(**dithMat));
-+
- dithMat = malloc(dithMatSize);
-
- if (dithMat == NULL)
-diff -up netpbm-10.58.01/editor/specialty/pamoil.c.security-code netpbm-10.58.01/editor/specialty/pamoil.c
---- netpbm-10.58.01/editor/specialty/pamoil.c.security-code 2012-04-09 15:31:33.000000000 +0200
-+++ netpbm-10.58.01/editor/specialty/pamoil.c 2012-04-09 15:40:03.224619526 +0200
-@@ -112,6 +112,7 @@ main(int argc, char *argv[] ) {
- tuples = pnm_readpam(ifp, &inpam, PAM_STRUCT_SIZE(tuple_type));
- pm_close(ifp);
+diff -urNp a/editor/specialty/pamoil.c b/editor/specialty/pamoil.c
+--- a/editor/specialty/pamoil.c 2025-02-03 09:24:28.301500720 +0100
++++ b/editor/specialty/pamoil.c 2025-02-04 09:56:21.543650456 +0100
+@@ -185,6 +185,7 @@ main(int argc, const char ** argv) {
+
+ tuples = pnm_readpam(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));
+ overflow_add(inpam.maxval, 1);
MALLOCARRAY(hist, inpam.maxval + 1);
if (hist == NULL)
pm_error("Unable to allocate memory for histogram.");
-diff -up netpbm-10.58.01/generator/pbmtext.c.security-code netpbm-10.58.01/generator/pbmtext.c
---- netpbm-10.58.01/generator/pbmtext.c.security-code 2012-04-09 15:31:34.000000000 +0200
-+++ netpbm-10.58.01/generator/pbmtext.c 2012-04-09 15:40:03.225619514 +0200
-@@ -96,12 +96,14 @@ parseCommandLine(int argc, const char **
-
- for (i = 1; i < argc; ++i) {
- if (i > 1) {
-+ overflow_add(totaltextsize, 1);
- totaltextsize += 1;
- text = realloc(text, totaltextsize);
- if (text == NULL)
- pm_error("out of memory allocating space for input text");
- strcat(text, " ");
- }
-+ overflow_add(totaltextsize, strlen(argv[i]));
- totaltextsize += strlen(argv[i]);
- text = realloc(text, totaltextsize);
- if (text == NULL)
-@@ -712,6 +714,7 @@ getText(const char cmdline_text
- pm_error("A line of input text is longer than %u characters."
- "Cannot process.", (unsigned)sizeof(buf)-1);
- if (lineCount >= maxlines) {
-+ overflow2(maxlines, 2);
- maxlines *= 2;
- REALLOCARRAY(text_array, maxlines);
- if (text_array == NULL)
-@@ -832,6 +835,7 @@ main(int argc, const char *argv[]) {
- hmargin = fontP->maxwidth;
- } else {
- vmargin = fontP->maxheight;
-+ overflow2(2, fontP->maxwidth);
- hmargin = 2 * fontP->maxwidth;
- }
- }
-diff -up netpbm-10.58.01/generator/pgmcrater.c.security-code netpbm-10.58.01/generator/pgmcrater.c
---- netpbm-10.58.01/generator/pgmcrater.c.security-code 2012-04-09 15:31:34.000000000 +0200
-+++ netpbm-10.58.01/generator/pgmcrater.c 2012-04-09 15:40:03.226619502 +0200
-@@ -130,7 +130,7 @@ static void gencraters()
- /* Acquire the elevation array and initialize it to mean
- surface elevation. */
-
-- MALLOCARRAY(aux, SCRX * SCRY);
-+ aux = (unsigned short *) malloc3(SCRX, SCRY, sizeof(short));
- if (aux == NULL)
- pm_error("out of memory allocating elevation array");
-
-diff -up netpbm-10.58.01/lib/libpam.c.security-code netpbm-10.58.01/lib/libpam.c
---- netpbm-10.58.01/lib/libpam.c.security-code 2012-04-09 15:31:38.000000000 +0200
-+++ netpbm-10.58.01/lib/libpam.c 2012-04-09 15:40:03.227619490 +0200
-@@ -220,7 +220,8 @@ allocPamRow(const struct pam * const pam
+diff -urNp a/lib/libpam.c b/lib/libpam.c
+--- a/lib/libpam.c 2025-02-03 09:24:28.326500585 +0100
++++ b/lib/libpam.c 2025-02-04 10:04:33.126859799 +0100
+@@ -258,6 +258,7 @@ allocPamRow(const struct pam * const pam
unsigned int const bytesPerTuple = allocationDepth(pamP) * sizeof(sample);
tuple * tuplerow;
-- tuplerow = malloc(pamP->width * (sizeof(tuple *) + bytesPerTuple));
+ overflow_add(sizeof(tuple *), bytesPerTuple);
-+ tuplerow = malloc2(pamP->width, (sizeof(tuple *) + bytesPerTuple));
-
+ tuplerow = malloc(pamP->width * (sizeof(tuple *) + bytesPerTuple));
+
if (tuplerow != NULL) {
- /* Now we initialize the pointers to the individual tuples
-diff -up netpbm-10.58.01/lib/libpammap.c.security-code netpbm-10.58.01/lib/libpammap.c
---- netpbm-10.58.01/lib/libpammap.c.security-code 2012-04-09 15:31:38.000000000 +0200
-+++ netpbm-10.58.01/lib/libpammap.c 2012-04-09 15:40:03.228619477 +0200
-@@ -104,6 +104,8 @@ allocTupleIntListItem(struct pam * const
- */
- struct tupleint_list_item * retval;
+diff -urNp a/lib/libpammap.c b/lib/libpammap.c
+--- a/lib/libpammap.c 2025-02-03 09:24:28.325500590 +0100
++++ b/lib/libpammap.c 2025-02-04 10:05:45.382614292 +0100
+@@ -111,6 +111,9 @@ allocTupleIntListItem(struct pam * const
+ if (pamP->depth > (UINT_MAX - sizeof(*retval)) / sizeof(sample))
+ pm_error("Depth %u is too large for computation", pamP->depth);
+ overflow2(pamP->depth, sizeof(sample));
+ overflow_add(sizeof(*retval)-sizeof(retval->tupleint.tuple), pamP->depth*sizeof(sample));
- unsigned int const size =
- sizeof(*retval) - sizeof(retval->tupleint.tuple)
++
+ unsigned int const size =
+ sizeof(*retval) - sizeof(retval->tupleint.tuple)
+ pamP->depth * sizeof(sample);
-diff -up netpbm-10.58.01/lib/libpm.c.security-code netpbm-10.58.01/lib/libpm.c
---- netpbm-10.58.01/lib/libpm.c.security-code 2012-04-09 15:31:38.000000000 +0200
-+++ netpbm-10.58.01/lib/libpm.c 2012-04-09 15:40:03.229619464 +0200
-@@ -808,4 +808,53 @@ pm_parse_height(const char * const arg)
+diff -urNp a/lib/libpm.c b/lib/libpm.c
+--- a/lib/libpm.c 2025-02-03 09:24:28.324500595 +0100
++++ b/lib/libpm.c 2025-02-04 10:27:02.795619696 +0100
+@@ -926,4 +926,52 @@ pm_parse_maxval(const char * const arg)
+ return maxval;
}
-
+/*
-+ * Maths wrapping
++ * Maths wrapping
+ */
-+
++
+void __overflow2(int a, int b)
+{
-+ if(a < 0 || b < 0)
-+ pm_error("object too large");
-+ if(b == 0)
-+ return;
-+ if(a > INT_MAX / b)
-+ pm_error("object too large");
++ if(a < 0 || b < 0)
++ pm_error("object too large");
++ if(b == 0)
++ return;
++ if(a > INT_MAX / b)
++ pm_error("object too large");
+}
+
+void overflow3(int a, int b, int c)
+{
-+ overflow2(a,b);
-+ overflow2(a*b, c);
++ overflow2(a,b);
++ overflow2(a*b, c);
+}
+
+void overflow_add(int a, int b)
+{
-+ if( a > INT_MAX - b)
-+ pm_error("object too large");
++ if( a > INT_MAX - b)
++ pm_error("object too large");
+}
+
+void *malloc2(int a, int b)
+{
-+ overflow2(a, b);
-+ if(a*b == 0)
-+ pm_error("Zero byte allocation");
-+ return malloc(a*b);
++ overflow2(a, b);
++ if(a*b == 0)
++ pm_error("Zero byte allocation");
++ return malloc(a*b);
+}
+
+void *malloc3(int a, int b, int c)
+{
-+ overflow3(a, b, c);
-+ if(a*b*c == 0)
-+ pm_error("Zero byte allocation");
-+ return malloc(a*b*c);
++ overflow3(a, b, c);
++ if(a*b*c == 0)
++ pm_error("Zero byte allocation");
++ return malloc(a*b*c);
+}
-+
+void *realloc2(void * a, int b, int c)
+{
-+ overflow2(b, c);
-+ if(b*c == 0)
-+ pm_error("Zero byte allocation");
-+ return realloc(a, b*c);
++ overflow2(b, c);
++ if(b*c == 0)
++ pm_error("Zero byte allocation");
++ return realloc(a, b*c);
+}
-diff -up netpbm-10.58.01/lib/pm.h.security-code netpbm-10.58.01/lib/pm.h
---- netpbm-10.58.01/lib/pm.h.security-code 2012-04-09 15:31:38.000000000 +0200
-+++ netpbm-10.58.01/lib/pm.h 2012-04-09 15:40:03.229619464 +0200
-@@ -432,4 +432,11 @@ pm_parse_height(const char * const arg);
- #endif
-
+diff -urNp a/lib/pm.h b/lib/pm.h
+--- a/lib/pm.h 2025-02-03 09:24:28.327500579 +0100
++++ b/lib/pm.h 2025-02-04 10:28:10.427411309 +0100
+@@ -439,6 +439,13 @@ pm_parse_height(const char * const arg);
+ unsigned int
+ pm_parse_maxval(const char * const arg);
+void *malloc2(int, int);
+void *malloc3(int, int, int);
@@ -1186,187 +796,65 @@ diff -up netpbm-10.58.01/lib/pm.h.security-code netpbm-10.58.01/lib/pm.h
+void overflow3(int, int, int);
+void overflow_add(int, int);
+
+ #ifdef __cplusplus
+ }
#endif
-diff -up netpbm-10.58.01/other/pnmcolormap.c.security-code netpbm-10.58.01/other/pnmcolormap.c
---- netpbm-10.58.01/other/pnmcolormap.c.security-code 2012-04-09 15:31:32.000000000 +0200
-+++ netpbm-10.58.01/other/pnmcolormap.c 2012-04-09 15:40:03.230619451 +0200
-@@ -840,6 +840,7 @@ colormapToSquare(struct pam * const pamP
+diff -urNp a/other/pnmcolormap.c b/other/pnmcolormap.c
+--- a/other/pnmcolormap.c 2025-02-03 09:24:28.303500709 +0100
++++ b/other/pnmcolormap.c 2025-02-04 10:29:08.620231936 +0100
+@@ -1130,8 +1130,10 @@ colormapToSquare(struct pam * const pamP
+ unsigned int const intsqrt = (int)sqrt((float)colormap.size);
+ if (SQR(intsqrt) == colormap.size)
pamP->width = intsqrt;
- else
- pamP->width = intsqrt + 1;
+- else
++ else {
+ overflow_add(intsqrt, 1);
+ pamP->width = intsqrt + 1;
++ }
}
{
unsigned int const intQuotient = colormap.size / pamP->width;
-diff -up netpbm-10.58.01/urt/README.security-code netpbm-10.58.01/urt/README
---- netpbm-10.58.01/urt/README.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/README 2012-04-09 15:40:03.231619438 +0200
-@@ -18,3 +18,8 @@ in its initializer in the original. But
- defines stdout as a variable, so that wouldn't compile. So I changed
- it to NULL and added a line to rle_hdr_init to set that field to
- 'stdout' dynamically. 2000.06.02 BJH.
-+
-+Redid the code to check for maths overflows and other crawly horrors.
-+Removed pipe through and compress support (unsafe)
-+
-+Alan Cox
-diff -up netpbm-10.58.01/urt/rle_addhist.c.security-code netpbm-10.58.01/urt/rle_addhist.c
---- netpbm-10.58.01/urt/rle_addhist.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/rle_addhist.c 2012-04-09 15:40:03.231619438 +0200
-@@ -14,6 +14,8 @@
- * If you modify this software, you should include a notice giving the
- * name of the person performing the modification, the date of modification,
- * and the reason for such modification.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
- */
- /*
- * rle_addhist.c - Add to the HISTORY comment in header
-@@ -71,13 +73,19 @@ rle_addhist(char * argv[],
- return;
-
- length = 0;
-- for (i = 0; argv[i]; ++i)
-+ for (i = 0; argv[i]; ++i) {
-+ overflow_add(length, strlen(argv[i]));
-+ overflow_add(length+1, strlen(argv[i]));
- length += strlen(argv[i]) +1; /* length of each arg plus space. */
-+ }
-
- time(&temp);
- timedate = ctime(&temp);
- length += strlen(timedate); /* length of date and time in ASCII. */
+diff -urNp a/urt/rle_addhist.c b/urt/rle_addhist.c
+--- a/urt/rle_addhist.c 2025-02-03 09:24:28.360500401 +0100
++++ b/urt/rle_addhist.c 2025-02-04 10:37:56.010607217 +0100
+@@ -52,6 +52,8 @@ newCommentLen(const char * const histoi
+ for (i = 0; argv[i]; ++i) {
+ size_t const thisArgLen = strlen(argv[i]);
+ if (thisArgLen < UINT_MAX - length - 100) {
++ overflow_add(length, thisArgLen);
++ overflow_add(length+thisArgLen, 1);
+ length += thisArgLen;
+ length += 1; /* For the space */
+ }
+@@ -61,10 +63,16 @@ newCommentLen(const char * const histoi
+ length += strlen(timedate);
+ /* Add length of padding, "on ", and length of history name plus "="*/
+ overflow_add(strlen(padding), 4);
+ overflow_add(strlen(histoire), strlen(padding) + 4);
+ overflow_add(length, strlen(histoire) + strlen(padding) + 4);
length += strlen(padding) + 3 + strlen(histoire) + 1;
- /* length of padding, "on " and length of history name plus "="*/
- if (in_hdr) /* if we are interested in the old comments... */
-@@ -85,9 +93,12 @@ rle_addhist(char * argv[],
- else
- old = NULL;
-
+
- if (old && *old)
++ overflow_add(length, 1);
+ if (old && *old) {
-+ overflow_add(length, strlen(old));
++ overflow_add(length, strlen(old));
length += strlen(old); /* add length if there. */
+ }
-+ overflow_add(length, 1);
- ++length; /*Cater for the null. */
+ ++length; /* Add size of terminating NUL. */
- MALLOCARRAY(newc, length);
-diff -up netpbm-10.58.01/urt/rle_getrow.c.security-code netpbm-10.58.01/urt/rle_getrow.c
---- netpbm-10.58.01/urt/rle_getrow.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/rle_getrow.c 2012-04-09 15:40:03.232619426 +0200
-@@ -17,6 +17,8 @@
- *
- * Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
- * to have all "void" functions so declared.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
- */
- /*
- * rle_getrow.c - Read an RLE file in.
-@@ -168,6 +170,7 @@ rle_get_setup(rle_hdr * const the_hdr) {
- register char * cp;
-
- VAXSHORT( comlen, infile ); /* get comment length */
-+ overflow_add(comlen, 1);
- evenlen = (comlen + 1) & ~1; /* make it even */
- if ( evenlen )
- {
-diff -up netpbm-10.58.01/urt/rle_hdr.c.security-code netpbm-10.58.01/urt/rle_hdr.c
---- netpbm-10.58.01/urt/rle_hdr.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/rle_hdr.c 2012-04-09 15:40:03.233619414 +0200
-@@ -14,6 +14,8 @@
- * If you modify this software, you should include a notice giving the
- * name of the person performing the modification, the date of modification,
- * and the reason for such modification.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
- */
- /*
- * rle_hdr.c - Functions to manipulate rle_hdr structures.
-@@ -80,7 +82,10 @@ int img_num;
- /* Fill in with copies of the strings. */
- if ( the_hdr->cmd != pgmname )
- {
-- char *tmp = (char *)malloc( strlen( pgmname ) + 1 );
-+ char *tmp ;
-+
-+ overflow_add(strlen(pgmname), 1);
-+ tmp = malloc( strlen( pgmname ) + 1 );
- RLE_CHECK_ALLOC( pgmname, tmp, 0 );
- strcpy( tmp, pgmname );
- the_hdr->cmd = tmp;
-@@ -88,7 +93,9 @@ int img_num;
-
- if ( the_hdr->file_name != fname )
- {
-- char *tmp = (char *)malloc( strlen( fname ) + 1 );
-+ char *tmp;
-+ overflow_add(strlen(fname), 1);
-+ tmp = malloc( strlen( fname ) + 1 );
- RLE_CHECK_ALLOC( pgmname, tmp, 0 );
- strcpy( tmp, fname );
- the_hdr->file_name = tmp;
-@@ -153,6 +160,7 @@ rle_hdr *from_hdr, *to_hdr;
- if ( to_hdr->bg_color )
- {
- int size = to_hdr->ncolors * sizeof(int);
-+ overflow2(to_hdr->ncolors, sizeof(int));
- to_hdr->bg_color = (int *)malloc( size );
- RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->bg_color, "background color" );
- memcpy( to_hdr->bg_color, from_hdr->bg_color, size );
-@@ -161,7 +169,7 @@ rle_hdr *from_hdr, *to_hdr;
- if ( to_hdr->cmap )
- {
- int size = to_hdr->ncmap * (1 << to_hdr->cmaplen) * sizeof(rle_map);
-- to_hdr->cmap = (rle_map *)malloc( size );
-+ to_hdr->cmap = (rle_map *)malloc3( to_hdr->ncmap, 1<cmaplen, sizeof(rle_map));
- RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->cmap, "color map" );
- memcpy( to_hdr->cmap, from_hdr->cmap, size );
- }
-@@ -174,11 +182,16 @@ rle_hdr *from_hdr, *to_hdr;
- int size = 0;
- CONST_DECL char **cp;
- for ( cp=to_hdr->comments; *cp; cp++ )
-+ {
-+ overflow_add(size, 1);
- size++; /* Count the comments. */
-+ }
- /* Check if there are really any comments. */
- if ( size )
- {
-+ overflow_add(size, 1);
- size++; /* Copy the NULL pointer, too. */
-+ overflow2(size, sizeof(char *));
- size *= sizeof(char *);
- to_hdr->comments = (CONST_DECL char **)malloc( size );
- RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->comments, "comments" );
-diff -up netpbm-10.58.01/urt/rle.h.security-code netpbm-10.58.01/urt/rle.h
---- netpbm-10.58.01/urt/rle.h.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/rle.h 2012-04-09 15:40:03.233619414 +0200
-@@ -14,6 +14,9 @@
- * If you modify this software, you should include a notice giving the
- * name of the person performing the modification, the date of modification,
- * and the reason for such modification.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
-+ * Header declarations needed
- */
- /*
- * rle.h - Global declarations for Utah Raster Toolkit RLE programs.
-@@ -160,6 +163,17 @@ rle_hdr /* End of typedef. *
+diff -urNp a/urt/rle.h b/urt/rle.h
+--- a/urt/rle.h 2025-02-03 09:24:28.360500401 +0100
++++ b/urt/rle.h 2025-02-04 10:33:12.842479585 +0100
+@@ -153,6 +153,17 @@ rle_hdr /* End of typedef. *
*/
extern rle_hdr rle_dflt_hdr;
-+/*
++/*
+ * Provided by pm library
+ */
-+
++
+extern void overflow_add(int, int);
+#define overflow2(a,b) __overflow2(a,b)
+extern void __overflow2(int, int);
@@ -1377,273 +865,56 @@ diff -up netpbm-10.58.01/urt/rle.h.security-code netpbm-10.58.01/urt/rle.h
/* Declare RLE library routines. */
-diff -up netpbm-10.58.01/urt/rle_open_f.c.security-code netpbm-10.58.01/urt/rle_open_f.c
---- netpbm-10.58.01/urt/rle_open_f.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/rle_open_f.c 2012-04-09 15:40:03.234619402 +0200
-@@ -163,65 +163,7 @@ dealWithSubprocess(const char * const f
- FILE ** const fpP,
- bool * const noSubprocessP,
- const char ** const errorP) {
--
--#ifdef NO_OPEN_PIPES
- *noSubprocessP = TRUE;
--#else
-- const char *cp;
--
-- reapChildren(catchingChildrenP, pids);
--
-- /* Real file, not stdin or stdout. If name ends in ".Z",
-- * pipe from/to un/compress (depending on r/w mode).
-- *
-- * If it starts with "|", popen that command.
-- */
--
-- cp = file_name + strlen(file_name) - 2;
-- /* Pipe case. */
-- if (file_name[0] == '|') {
-- pid_t thepid; /* PID from my_popen */
--
-- *noSubprocessP = FALSE;
--
-- *fpP = my_popen(file_name + 1, mode, &thepid);
-- if (*fpP == NULL)
-- *errorP = "%s: can't invoke <<%s>> for %s: ";
-- else {
-- /* One more child to catch, eventually. */
-- if (*catchingChildrenP < MAX_CHILDREN)
-- pids[(*catchingChildrenP)++] = thepid;
-- }
-- } else if (cp > file_name && *cp == '.' && *(cp + 1) == 'Z' ) {
-- /* Compress case. */
-- pid_t thepid; /* PID from my_popen. */
-- const char * command;
--
-- *noSubprocessP = FALSE;
--
-- if (*mode == 'w')
-- pm_asprintf(&command, "compress > %s", file_name);
-- else if (*mode == 'a')
-- pm_asprintf(&command, "compress >> %s", file_name);
-- else
-- pm_asprintf(&command, "compress -d < %s", file_name);
--
-- *fpP = my_popen(command, mode, &thepid);
--
-- if (*fpP == NULL)
-- *errorP = "%s: can't invoke 'compress' program, "
-- "trying to open %s for %s";
-- else {
-- /* One more child to catch, eventually. */
-- if (*catchingChildrenP < MAX_CHILDREN)
-- pids[(*catchingChildrenP)++] = thepid;
-- }
-- pm_strfree(command);
-- } else {
-- *noSubprocessP = TRUE;
-- *errorP = NULL;
-- }
--#endif
- }
+diff -urNp a/urt/rle_hdr.c b/urt/rle_hdr.c
+--- a/urt/rle_hdr.c 2025-02-03 09:24:28.360500401 +0100
++++ b/urt/rle_hdr.c 2025-02-04 10:42:11.745682618 +0100
+@@ -148,7 +148,7 @@ rle_hdr_cp(rle_hdr * const fromHdrP,
+ if (toHdrP->cmap) {
+ size_t const size =
+ toHdrP->ncmap * (1 << toHdrP->cmaplen) * sizeof(rle_map);
+- toHdrP->cmap = malloc(size);
++ toHdrP->cmap = malloc3(toHdrP->ncmap, 1<cmaplen, sizeof(rle_map));
+ if (!toHdrP->cmap)
+ pm_error("Failed to allocate memory for %u color maps "
+ "of length %u", toHdrP->ncmap, 1 << toHdrP->cmaplen);
+@@ -163,12 +163,16 @@ rle_hdr_cp(rle_hdr * const fromHdrP,
+ const char ** cp;
+ /* Count the comments. */
+- for (cp = toHdrP->comments, size = 0; *cp; ++cp)
++ for (cp = toHdrP->comments, size = 0; *cp; ++cp) {
++ overflow_add(size,1);
+ ++size;
++ }
-diff -up netpbm-10.58.01/urt/rle_putcom.c.security-code netpbm-10.58.01/urt/rle_putcom.c
---- netpbm-10.58.01/urt/rle_putcom.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/rle_putcom.c 2012-04-09 15:40:03.234619402 +0200
-@@ -14,6 +14,8 @@
- * If you modify this software, you should include a notice giving the
- * name of the person performing the modification, the date of modification,
- * and the reason for such modification.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
- */
- /*
- * rle_putcom.c - Add a picture comment to the header struct.
-@@ -98,12 +100,14 @@ rle_putcom(const char * const value,
- const char * v;
- const char ** old_comments;
- int i;
-- for (i = 2, cp = the_hdr->comments; *cp != NULL; ++i, ++cp)
-+ for (i = 2, cp = the_hdr->comments; *cp != NULL; ++i, ++cp) {
-+ overflow_add(i, 1);
+ /* Check if there are really any comments. */
+ if (size > 0) {
++ overflow_add(size,1);
+ ++size; /* Copy the NULL pointer, too. */
++ overflow2(size, sizeof(char *));
+ size *= sizeof(char *);
+ toHdrP->comments = malloc(size);
+ if (!toHdrP->comments)
+diff -urNp a/urt/rle_putcom.c b/urt/rle_putcom.c
+--- a/urt/rle_putcom.c 2025-02-03 09:24:28.360500401 +0100
++++ b/urt/rle_putcom.c 2025-02-04 10:43:04.472477242 +0100
+@@ -101,6 +101,7 @@ rle_putcom(const char * const value,
+ for (i = 2, cp = hdrP->comments;
+ *cp != NULL && i < UINT_MAX;
+ ++i, ++cp) {
++ overflow_add(i, 1);
if (match(value, *cp) != NULL) {
v = *cp;
*cp = value;
- return v;
- }
-+ }
- /* Not found */
- /* Can't realloc because somebody else might be pointing to this
- * comments block. Of course, if this were true, then the
-diff -up netpbm-10.58.01/urt/Runput.c.security-code netpbm-10.58.01/urt/Runput.c
---- netpbm-10.58.01/urt/Runput.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/Runput.c 2012-04-09 15:40:03.235619390 +0200
-@@ -17,6 +17,8 @@
- *
- * Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
- * to have all "void" functions so declared.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
- */
- /*
- * Runput.c - General purpose Run Length Encoding.
-@@ -202,9 +204,11 @@ RunSetup(rle_hdr * the_hdr)
- if ( the_hdr->background != 0 )
- {
- register int i;
-- register rle_pixel *background =
-- (rle_pixel *)malloc( (unsigned)(the_hdr->ncolors + 1) );
-+ register rle_pixel *background;
- register int *bg_color;
-+
-+ overflow_add(the_hdr->ncolors,1);
-+ background = (rle_pixel *)malloc( (unsigned)(the_hdr->ncolors + 1) );
- /*
- * If even number of bg color bytes, put out one more to get to
- * 16 bit boundary.
-@@ -224,7 +228,7 @@ RunSetup(rle_hdr * the_hdr)
- /* Big-endian machines are harder */
- register int i, nmap = (1 << the_hdr->cmaplen) *
- the_hdr->ncmap;
-- register char *h_cmap = (char *)malloc( nmap * 2 );
-+ register char *h_cmap = (char *)malloc2( nmap, 2 );
- if ( h_cmap == NULL )
- {
- fprintf( stderr,
-diff -up netpbm-10.58.01/urt/scanargs.c.security-code netpbm-10.58.01/urt/scanargs.c
---- netpbm-10.58.01/urt/scanargs.c.security-code 2012-04-09 15:31:45.000000000 +0200
-+++ netpbm-10.58.01/urt/scanargs.c 2012-04-09 15:40:03.235619390 +0200
-@@ -38,6 +38,8 @@
- *
- * Modified at BRL 16-May-88 by Mike Muuss to avoid Alliant STDC desire
- * to have all "void" functions so declared.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
- */
+diff -urNp a/urt/Runput.c b/urt/Runput.c
+--- a/urt/Runput.c 2025-02-03 09:24:28.360500401 +0100
++++ b/urt/Runput.c 2025-02-04 10:30:24.683997548 +0100
+@@ -236,7 +236,7 @@ RunSetup(rle_hdr * const hdrP) {
+ int * bg_color;
- #include
-@@ -63,8 +65,8 @@ typedef int *ptr;
- /*
- * Storage allocation macros
- */
--#define NEW( type, cnt ) (type *) malloc( (cnt) * sizeof( type ) )
--#define RENEW( type, ptr, cnt ) (type *) realloc( ptr, (cnt) * sizeof( type ) )
-+#define NEW( type, cnt ) (type *) malloc2( (cnt) , sizeof( type ) )
-+#define RENEW( type, ptr, cnt ) (type *) realloc2( ptr, (cnt), sizeof( type ) )
+ assert(hdrP->ncolors < UINT_MAX);
+-
++ overflow_add(hdrP->ncolors, 1);
+ MALLOCARRAY_NOFAIL(background, hdrP->ncolors + 1);
- static CONST_DECL char * prformat( CONST_DECL char *, int );
- static int isnum( CONST_DECL char *, int, int );
-diff --git a/converter/other/pnmtorle.c b/converter/other/pnmtorle.c
-index 180b144..d99d99f 100644
---- a/converter/other/pnmtorle.c
-+++ b/converter/other/pnmtorle.c
-@@ -19,6 +19,8 @@
- * If you modify this software, you should include a notice giving the
- * name of the person performing the modification, the date of modification,
- * and the reason for such modification.
-+ *
-+ * 2002-12-19: Fix maths wrapping bugs. Alan Cox
- */
- /*
- * pnmtorle - A program which will convert pbmplus (ppm or pgm) images
-diff --git a/converter/ppm/ppmtoilbm.c b/converter/ppm/ppmtoilbm.c
-index e114457..7c46307 100644
---- a/converter/ppm/ppmtoilbm.c
-+++ b/converter/ppm/ppmtoilbm.c
-@@ -185,6 +185,7 @@ makeValTable(int const oldmaxval,
- unsigned int i;
- int * table;
-
-+ overflow_add(oldmaxval, 1);
- MALLOCARRAY_NOFAIL(table, oldmaxval + 1);
- for (i = 0; i <= oldmaxval; ++i)
- table[i] = ROUNDDIV(i * newmaxval, oldmaxval);
-@@ -2328,8 +2329,11 @@ main(int argc, char ** argv) {
- MALLOCARRAY_NOFAIL(coded_rowbuf, RowBytes(cols));
- for (i = 0; i < RowBytes(cols); ++i)
- coded_rowbuf[i] = 0;
-- if (DO_COMPRESS)
-+ if (DO_COMPRESS) {
-+ overflow2(cols,2);
-+ overflow_add(cols*2,2);
- MALLOCARRAY_NOFAIL(compr_rowbuf, WORSTCOMPR(RowBytes(cols)));
-+ }
- }
-
- switch (mode) {
-diff --git a/editor/pnmshear.c b/editor/pnmshear.c
-index 99fa302..dedce11 100644
---- a/editor/pnmshear.c
-+++ b/editor/pnmshear.c
-@@ -15,6 +15,7 @@
- #include
- #include
- #include
-+#include
-
- #include "pm_c_util.h"
- #include "mallocvar.h"
-@@ -242,6 +243,11 @@ main(int argc, const char * argv[]) {
-
- shearfac = fabs(tan(cmdline.angle));
-
-+ if(rows * shearfac >= INT_MAX-1)
-+ pm_error("image too large");
-+
-+ overflow_add(rows * shearfac, cols+1);
-+
- newcols = rows * shearfac + cols + 0.999999;
-
- pnm_writepnminit(stdout, newcols, rows, newmaxval, newformat, 0);
-diff --git a/lib/libpbm1.c b/lib/libpbm1.c
-index c96779e..543fa36 100644
---- a/lib/libpbm1.c
-+++ b/lib/libpbm1.c
-@@ -78,6 +78,7 @@ pbm_check(FILE * const fileP,
- } else {
- pm_filepos const bytesPerRow = (cols+7)/8;
- pm_filepos const needRasterSize = rows * bytesPerRow;
-+ overflow2(bytesPerRow, rows);
- pm_check(fileP, checkType, needRasterSize, retvalP);
- }
- }
-diff --git a/converter/other/pnmtosgi.c b/converter/other/pnmtosgi.c
-index a8df532..514e9e6 100644
---- a/converter/other/pnmtosgi.c
-+++ b/converter/other/pnmtosgi.c
-@@ -176,6 +176,8 @@ compress(ScanElem * const tempArg,
- break;
- case STORAGE_RLE: {
- unsigned int const tabrow = chanNum * rows + row;
-+ overflow2(chanNum, rows);
-+ overflow_add(chanNum* rows, row);
- unsigned int const len = rleCompress(tempArg, cols);
- /* writes result into rletemp */
- unsigned int i;
-@@ -212,6 +214,7 @@ buildChannels(FILE * const ifP,
- ScanElem * temp;
-
- if (storage != STORAGE_VERBATIM) {
-+ overflow2(channels, rows);
- MALLOCARRAY_NOFAIL(table, channels * rows);
- MALLOCARRAY_NOFAIL(rletemp, WORSTCOMPR(cols));
- } else
-diff --git a/converter/other/sgitopnm.c b/converter/other/sgitopnm.c
-index 008d537..ea9a2e9 100644
---- a/converter/other/sgitopnm.c
-+++ b/converter/other/sgitopnm.c
-@@ -372,10 +372,14 @@ readChannels(FILE * const ifP,
- MALLOCARRAY_NOFAIL(image, head->ysize);
- } else {
- maxchannel = 3;
-+ overflow2(head->ysize, maxchannel);
- MALLOCARRAY_NOFAIL(image, head->ysize * maxchannel);
- }
-- if (table)
-+ if (table) {
-+ overflow2(head->xsize, 2);
-+ overflow2(head->xsize*2, 2);
- MALLOCARRAY_NOFAIL(temp, WORSTCOMPR(head->xsize));
-+ }
-
- for (channel = 0; channel < maxchannel; ++channel) {
- unsigned int row;
+ /* If even number of bg color bytes, put out one more to get to
diff --git a/netpbm-security-scripts.patch b/netpbm-security-scripts.patch
deleted file mode 100644
index 6a9b197..0000000
--- a/netpbm-security-scripts.patch
+++ /dev/null
@@ -1,368 +0,0 @@
-diff --git a/converter/other/anytopnm b/converter/other/anytopnm
-index acf8813..335312a 100755
---- a/converter/other/anytopnm
-+++ b/converter/other/anytopnm
-@@ -511,10 +511,7 @@ else
- inputFile="-"
- fi
-
--tempdir="${TMPDIR-/tmp}/anytopnm.$$"
--mkdir -m 0700 $tempdir || \
-- { echo "Could not create temporary file. Exiting."; exit 1;}
--trap 'rm -rf $tempdir' 0
-+tempdir=$(mktemp -d -t anytopnm.XXXXXXXXXX) || exit 1
-
- # Take out all spaces
- # Find the filename extension for last-ditch efforts later
-@@ -537,12 +534,17 @@ typeDescription=`file "$file" | cut -d: -f2- | cut -c2-`
- determineType "$file" "$mimeType" "$typeDescription" "$fileExtension"
-
- if [ "$filetype" = "unknown" ]; then
-- echo "$progname: unknown file type. " \
-- "'file' says mime type is '$mimeType', " 1>&2
-- echo "type description is '$typeDescription'" 1>&2
-+ if [ -d "$tempdir" ] ; then
-+ rm -rf "$tempdir"
-+ fi
-+
- exit 1
- fi
-
- convertIt $file $filetype
-
-+if [ -d "$tempdir" ] ; then
-+ rm -rf "$tempdir"
-+fi
-+
- exit 0
-diff --git a/editor/pamstretch-gen b/editor/pamstretch-gen
-index ba0e818..250fca0 100755
---- a/editor/pamstretch-gen
-+++ b/editor/pamstretch-gen
-@@ -31,9 +31,7 @@ if [ "$1" = "" ]; then
- exit 1
- fi
-
--tempdir="${TMPDIR-/tmp}/pamstretch-gen.$$"
--mkdir -m 0700 $tempdir || \
-- { echo "Could not create temporary file. Exiting."; exit 1;}
-+tempfile=$(mktemp /tmp/pnmig.XXXXXXXXXX) || exit 1
- trap 'rm -rf $tempdir' 0 1 3 15
-
- tempfile=$tempdir/pnmig
-diff --git a/editor/pnmmargin b/editor/pnmmargin
-index 0f57d1d..e0d3625 100755
---- a/editor/pnmmargin
-+++ b/editor/pnmmargin
-@@ -11,11 +11,7 @@
- # documentation. This software is provided "as is" without express or
- # implied warranty.
-
--tempdir="${TMPDIR-/tmp}/pnmmargin.$$"
--mkdir -m 0700 $tempdir || \
-- { echo "Could not create temporary file. Exiting." 1>&2; exit 1;}
--trap 'rm -rf $tempdir' 0 1 3 15
--
-+tempdir=$(mktemp -d -t ppmmargin.XXXXXXX) || exit 1
- tmp1=$tempdir/pnmm1
- tmp2=$tempdir/pnmm2
- tmp3=$tempdir/pnmm3
-@@ -90,6 +86,7 @@ else
- -white | -black )
- pnmpad $plainopt $color \
- -left=$size -right=$size -top=$size -bottom=$size $tmp1
-+ rm -rf "$tempdir"
- exit
- ;;
- * )
-@@ -103,4 +100,4 @@ else
- pnmcat -tb $plainopt $tmp3 $tmp4 $tmp3
- fi
-
--
-+rm -rf "$tempdir"
-diff --git a/editor/ppmfade b/editor/ppmfade
-index 027fc79..8eb094f 100755
---- a/editor/ppmfade
-+++ b/editor/ppmfade
-@@ -40,6 +40,7 @@ exec perl -w -x -S -- "$0" "$@"
- #
- ##############################################################################
- use strict;
-+use File::Temp "tempdir";
-
- my $SPREAD = 1;
- my $SHIFT = 2;
-@@ -137,20 +138,26 @@ if ($first_file ne "undefined") {
-
- print("Frames are " . $width . "W x " . $height . "H\n");
-
-+#
-+# We create a tmp-directory right here
-+#
-+my $tmpdir = tempdir("ppmfade.XXXXXX", CLEANUP => 1);
-+
-+
- if ($first_file eq "undefined") {
- print "Fading from black to ";
-- system("ppmmake \\#000 $width $height >junk1$$.ppm");
-+ system("ppmmake \\#000 $width $height >$tmpdir/junk1$$.ppm");
- } else {
- print "Fading from $first_file to ";
-- system("cp", $first_file, "junk1$$.ppm");
-+ system("cp", $first_file, "$tmpdir/junk1$$.ppm");
- }
-
- if ($last_file eq "undefined") {
- print "black.\n";
-- system("ppmmake \\#000 $width $height >junk2$$.ppm");
-+ system("ppmmake \\#000 $width $height >$tmpdir/junk2$$.ppm");
- } else {
- print "$last_file\n";
-- system("cp", $last_file, "junk2$$.ppm");
-+ system("cp", $last_file, "$tmpdir/junk2$$.ppm");
- }
-
- #
-@@ -158,14 +165,14 @@ if ($last_file eq "undefined") {
- #
-
- # Here's what our temporary files are:
--# junk1$$.ppm: The original (fade-from) image
--# junk2$$.ppm: The target (fade-from) image
--# junk3$$.ppm: The frame of the fade for the current iteration of the
--# the for loop.
--# junk1a$$.ppm: If the fade involves a ppmmix sequence from one intermediate
--# image to another, this is the first frame of that
--# sequence.
--# junk2a$$.ppm: This is the last frame of the above-mentioned ppmmix sequence
-+# $tmpdir/junk1$$.ppm: The original (fade-from) image
-+# $tmpdir/junk2$$.ppm: The target (fade-from) image
-+# $tmpdir/junk3$$.ppm: The frame of the fade for the current iteration of the
-+# the for loop.
-+# $tmpdir/junk1a$$.ppm: If the fade involves a ppmmix sequence from one intermediate
-+# image to another, this is the first frame of that
-+# sequence.
-+# $tmpdir/junk2a$$.ppm: This is the last frame of the above-mentioned ppmmix sequence
-
- my $i; # Frame number
- for ($i = 1; $i <= $nframes; $i++) {
-@@ -173,147 +180,147 @@ for ($i = 1; $i <= $nframes; $i++) {
- if ($mode eq $SPREAD) {
- if ($i <= 10) {
- my $n = $spline20[$i] * 100;
-- system("ppmspread $n junk1$$.ppm >junk3$$.ppm");
-+ system("ppmspread $n $tmpdir/junk1$$.ppm >$tmpdir/junk3$$.ppm");
- } elsif ($i <= 20) {
- my $n;
- $n = $spline20[$i] * 100;
-- system("ppmspread $n junk1$$.ppm >junk1a$$.ppm");
-+ system("ppmspread $n $tmpdir/junk1$$.ppm >$tmpdir/junk1a$$.ppm");
- $n = (1-$spline20[$i-10]) * 100;
-- system("ppmspread $n junk2$$.ppm >junk2a$$.ppm");
-+ system("ppmspread $n $tmpdir/junk2$$.ppm >$tmpdir/junk2a$$.ppm");
- $n = $spline10[$i-10];
-- system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm");
- } else {
- my $n = (1-$spline20[$i-10])*100;
-- system("ppmspread $n junk2$$.ppm >junk3$$.ppm");
-+ system("ppmspread $n $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
- }
- } elsif ($mode eq $SHIFT) {
- if ($i <= 10) {
- my $n = $spline20[$i] * 100;
-- system("ppmshift $n junk1$$.ppm >junk3$$.ppm");
-+ system("ppmshift $n $tmpdir/junk1$$.ppm >$tmpdir/junk3$$.ppm");
- } elsif ($i <= 20) {
- my $n;
- $n = $spline20[$i] * 100;
-- system("ppmshift $n junk1$$.ppm >junk1a$$.ppm");
-+ system("ppmshift $n $tmpdir/junk1$$.ppm >$tmpdir/junk1a$$.ppm");
- $n = (1-$spline20[$i-10])*100;
-- system("ppmshift $n junk2$$.ppm >junk2a$$.ppm");
-+ system("ppmshift $n $tmpdir/junk2$$.ppm >$tmpdir/junk2a$$.ppm");
- $n = $spline10[$i-10];
-- system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm");
- } else {
- my $n = (1-$spline20[$i-10]) * 100;
-- system("ppmshift $n junk2$$.ppm >junk3$$.ppm");
-+ system("ppmshift $n $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
- }
- } elsif ($mode eq $RELIEF) {
- if ($i == 1) {
-- system("ppmrelief junk1$$.ppm >junk1r$$.ppm");
-+ system("ppmrelief $tmpdir/junk1$$.ppm >$tmpdir/junk1r$$.ppm");
- }
- if ($i <= 10) {
- my $n = $spline10[$i];
-- system("ppmmix $n junk1$$.ppm junk1r$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1r$$.ppm >$tmpdir/junk3$$.ppm");
- } elsif ($i <= 20) {
- my $n = $spline10[$i-10];
-- system("ppmmix $n junk1r$$.ppm junk2r$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1r$$.ppm $tmpdir/junk2r$$.ppm >$tmpdir/junk3$$.ppm");
- } else {
- my $n = $spline10[$i-20];
-- system("ppmmix $n junk2r$$.ppm junk2$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk2r$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
- }
- if ($i == 10) {
-- system("ppmrelief junk2$$.ppm >junk2r$$.ppm");
-+ system("ppmrelief $tmpdir/junk2$$.ppm >$tmpdir/junk2r$$.ppm");
- }
- } elsif ($mode eq $OIL) {
- if ($i == 1) {
-- system("ppmtopgm junk1$$.ppm | pgmoil >junko$$.ppm");
-- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
-- ">junk1o$$.ppm");
-+ system("ppmtopgm $tmpdir/junk1$$.ppm | pgmoil >$tmpdir/junko$$.ppm");
-+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
-+ ">$tmpdir/junk1o$$.ppm");
- }
- if ($i <= 10) {
- my $n = $spline10[$i];
-- system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm");
- } elsif ($i <= 20) {
- my $n = $spline10[$i-10];
-- system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm");
- } else {
- my $n = $spline10[$i-20];
-- system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
- }
- if ($i == 10) {
-- system("ppmtopgm junk2$$.ppm | pgmoil >junko$$.ppm");
-- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
-- ">junk2o$$.ppm");
-+ system("ppmtopgm $tmpdir/junk2$$.ppm | pgmoil >$tmpdir/junko$$.ppm");
-+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
-+ ">$tmpdir/junk2o$$.ppm");
- }
- } elsif ($mode eq $EDGE) {
- if ($i == 1) {
-- system("ppmtopgm junk1$$.ppm | pgmedge >junko$$.ppm");
-- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
-- ">junk1o$$.ppm");
-+ system("ppmtopgm $tmpdir/junk1$$.ppm | pgmedge >$tmpdir/junko$$.ppm");
-+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
-+ ">$tmpdir/junk1o$$.ppm");
- }
- if ($i <= 10) {
- my $n = $spline10[$i];
-- system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm");
- } elsif ($i <= 20) {
- my $n = $spline10[$i-10];
-- system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm");
- } else {
- my $n = $spline10[$i-20];
-- system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
- }
- if ($i == 10) {
-- system("ppmtopgm junk2$$.ppm | pgmedge >junko$$.ppm");
-- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
-- ">junk2o$$.ppm");
-+ system("ppmtopgm $tmpdir/junk2$$.ppm | pgmedge >$tmpdir/junko$$.ppm");
-+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
-+ ">$tmpdir/junk2o$$.ppm");
- }
- } elsif ($mode eq $BENTLEY) {
- if ($i == 1) {
-- system("ppmtopgm junk1$$.ppm | pgmbentley >junko$$.ppm");
-- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
-- ">junk1o$$.ppm");
-+ system("ppmtopgm $tmpdir/junk1$$.ppm | pgmbentley >$tmpdir/junko$$.ppm");
-+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
-+ ">$tmpdir/junk1o$$.ppm");
- }
- if ($i <= 10) {
- my $n = $spline10[$i];
-- system("ppmmix $n junk1$$.ppm junk1o$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1$$.ppm $tmpdir/junk1o$$.ppm >$tmpdir/junk3$$.ppm");
- } elsif ($i <= 20) {
- my $n = $spline10[$i-10];
-- system("ppmmix $n junk1o$$.ppm junk2o$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1o$$.ppm $tmpdir/junk2o$$.ppm >$tmpdir/junk3$$.ppm");
- } else {
- my $n = $spline10[$i-20];
-- system("ppmmix $n junk2o$$.ppm junk2$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk2o$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
- }
- if ($i == 10) {
-- system("ppmtopgm junk2$$.ppm | pgmbentley >junko$$.ppm");
-- system("rgb3toppm junko$$.ppm junko$$.ppm junko$$.ppm " .
-- ">junk2o$$.ppm");
-+ system("ppmtopgm $tmpdir/junk2$$.ppm | pgmbentley >$tmpdir/junko$$.ppm");
-+ system("rgb3toppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm $tmpdir/junko$$.ppm " .
-+ ">$tmpdir/junk2o$$.ppm");
- }
- } elsif ($mode eq $BLOCK) {
- if ($i <= 10) {
- my $n = 1 - 1.9*$spline20[$i];
-- system("pamscale $n junk1$$.ppm | " .
-- "pamscale -width $width -height $height >junk3$$.ppm");
-+ system("pamscale $n $tmpdir/junk1$$.ppm | " .
-+ "pamscale -width $width -height $height >$tmpdir/junk3$$.ppm");
- } elsif ($i <= 20) {
- my $n = $spline10[$i-10];
-- system("ppmmix $n junk1a$$.ppm junk2a$$.ppm >junk3$$.ppm");
-+ system("ppmmix $n $tmpdir/junk1a$$.ppm $tmpdir/junk2a$$.ppm >$tmpdir/junk3$$.ppm");
- } else {
- my $n = 1 - 1.9*$spline20[31-$i];
-- system("pamscale $n junk2$$.ppm | " .
-- "pamscale -width $width -height $height >junk3$$.ppm");
-+ system("pamscale $n $tmpdir/junk2$$.ppm | " .
-+ "pamscale -width $width -height $height >$tmpdir/junk3$$.ppm");
- }
- if ($i == 10) {
-- system("cp", "junk3$$.ppm", "junk1a$$.ppm");
-- system("pamscale $n junk2$$.ppm | " .
-- "pamscale -width $width -height $height >junk2a$$.ppm");
-+ system("cp", "$tmpdir/junk3$$.ppm", "$tmpdir/junk1a$$.ppm");
-+ system("pamscale $n $tmpdir/junk2$$.ppm | " .
-+ "pamscale -width $width -height $height >$tmpdir/junk2a$$.ppm");
- }
- } elsif ($mode eq $MIX) {
- my $fade_factor = sqrt(1/($nframes-$i+1));
-- system("ppmmix $fade_factor junk1$$.ppm junk2$$.ppm >junk3$$.ppm");
-+ system("ppmmix $fade_factor $tmpdir/junk1$$.ppm $tmpdir/junk2$$.ppm >$tmpdir/junk3$$.ppm");
- } else {
- print("Internal error: impossible mode value '$mode'\n");
- }
-
- my $outfile = sprintf("%s.%04d.ppm", $base_name, $i);
-- system("cp", "junk3$$.ppm", $outfile);
-+ system("cp", "$tmpdir/junk3$$.ppm", $outfile);
- }
-
- #
- # Clean up shop.
- #
--system("rm junk*$$.ppm");
-+system("rm $tmpdir/junk*$$.ppm");
-
- exit(0);
-diff --git a/editor/ppmshadow b/editor/ppmshadow
-index 62cdf8b..72e1b22 100755
---- a/editor/ppmshadow
-+++ b/editor/ppmshadow
-@@ -97,9 +97,10 @@ sub makeConvolutionKernel($$) {
-
-
- my $tmpdir = $ENV{TMPDIR} || "/tmp";
--my $ourtmp = "$tmpdir/ppmshadow$$";
--mkdir($ourtmp, 0777) or
-- die("Unable to create directory for temporary files '$ourtmp");
-+my $ourtmp; chomp($ourtmp = `mktemp -d -t PPMshadow.XXXXXX`);
-+if ($? >> 8) {
-+ die "Can't create directory for temporary files";
-+}
-
- # Process command line options
-
diff --git a/netpbm-shlib-ldflags.patch b/netpbm-shlib-ldflags.patch
new file mode 100644
index 0000000..ffad115
--- /dev/null
+++ b/netpbm-shlib-ldflags.patch
@@ -0,0 +1,13 @@
+diff --git a/config.mk.in b/config.mk.in
+index 50687ba..d35c982 100644
+--- a/config.mk.in
++++ b/config.mk.in
+@@ -250,7 +250,7 @@ EXE =
+
+ # Here, $(SONAME) resolves to the soname for the shared library being created.
+ # The following are gcc options. This works on GNU libc systems.
+-LDSHLIB = -shared -Wl,-soname,$(SONAME)
++LDSHLIB = $(LDFLAGS) -shared -Wl,-soname,$(SONAME)
+ # You need -nostart instead of -shared on BeOS. Though the BeOS compiler is
+ # ostensibly gcc, it has the -nostart option, which is not mentioned in gcc
+ # documentation and doesn't exist in at least one non-BeOS installation.
diff --git a/netpbm-werror.patch b/netpbm-werror.patch
deleted file mode 100644
index 692bbe4..0000000
--- a/netpbm-werror.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-diff --git a/converter/pbm/cmuwmtopbm.c b/converter/pbm/cmuwmtopbm.c
-index 5c138c1..1f9bc6c 100644
---- a/converter/pbm/cmuwmtopbm.c
-+++ b/converter/pbm/cmuwmtopbm.c
-@@ -48,20 +48,20 @@ readCmuwmHeader(FILE * const ifP,
-
- rc = pm_readbiglong(ifP, &l);
- if (rc == -1 )
-- pm_error(initReadError);
-+ pm_error("%s", initReadError);
- if ((uint32_t)l != cmuwmMagic)
- pm_error("bad magic number in CMU window manager file");
- rc = pm_readbiglong(ifP, &l);
- if (rc == -1)
-- pm_error(initReadError);
-+ pm_error("%s", initReadError);
- *colsP = l;
- rc = pm_readbiglong(ifP, &l);
- if (rc == -1 )
-- pm_error(initReadError);
-+ pm_error("%s", initReadError);
- *rowsP = l;
- rc = pm_readbigshort(ifP, &s);
- if (rc == -1)
-- pm_error(initReadError);
-+ pm_error("%s", initReadError);
- *depthP = s;
- }
-
-diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c
-index 3aa2e43..b8ebf39 100644
---- a/converter/other/tifftopnm.c
-+++ b/converter/other/tifftopnm.c
-@@ -1459,7 +1459,7 @@ convertRasterInMemory(pnmOut * const pnmOutP,
- int ok;
- ok = TIFFRGBAImageOK(tif, emsg);
- if (!ok) {
-- pm_message(emsg);
-+ pm_message("%s", emsg);
- *statusP = CONV_UNABLE;
- } else {
- uint32 * raster;
-@@ -1479,14 +1479,14 @@ convertRasterInMemory(pnmOut * const pnmOutP,
-
- ok = TIFFRGBAImageBegin(&img, tif, stopOnErrorFalse, emsg);
- if (!ok) {
-- pm_message(emsg);
-+ pm_message("%s", emsg);
- *statusP = CONV_FAILED;
- } else {
- int ok;
- ok = TIFFRGBAImageGet(&img, raster, cols, rows);
- TIFFRGBAImageEnd(&img) ;
- if (!ok) {
-- pm_message(emsg);
-+ pm_message("%s", emsg);
- *statusP = CONV_FAILED;
- } else {
- *statusP = CONV_DONE;
-diff --git a/lib/util/pm_c_util.h b/lib/util/pm_c_util.h
-index 01a0765..8f5aa01 100644
---- a/lib/util/pm_c_util.h
-+++ b/lib/util/pm_c_util.h
-@@ -80,10 +80,10 @@
- #endif
-
- #ifndef TRUE
-- #define TRUE true
-+ #define TRUE 1
- #endif
- #ifndef FALSE
-- #define FALSE false
-+ #define FALSE 0
- #endif
-
- #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-diff --git a/converter/other/fiasco/pnmtofiasco.c b/converter/other/fiasco/pnmtofiasco.c
-index d78ff6b..761dac5 100644
---- a/converter/other/fiasco/pnmtofiasco.c
-+++ b/converter/other/fiasco/pnmtofiasco.c
-@@ -170,7 +170,7 @@ main (int argc, char **argv)
- return 0;
- else
- {
-- fprintf (stderr, fiasco_get_error_message ());
-+ fprintf (stderr, "%s", fiasco_get_error_message ());
- fprintf (stderr, "\n");
- return 1;
- }
-diff --git a/converter/other/fiasco/params.c b/converter/other/fiasco/params.c
-index a4d843a..9659e9f 100644
---- a/converter/other/fiasco/params.c
-+++ b/converter/other/fiasco/params.c
-@@ -656,7 +656,7 @@ usage (const param_t *params, const char *progname, const char *synopsis,
- fprintf (stderr, "Usage: %s [OPTION]...%s\n", progname,
- non_opt_string ? non_opt_string : " ");
- if (synopsis != NULL)
-- fprintf (stderr, synopsis);
-+ fprintf (stderr, "%s\n", synopsis);
- fprintf (stderr, "\n\n");
- fprintf (stderr, "Mandatory or optional arguments to long options "
- "are mandatory or optional\nfor short options too. "
diff --git a/netpbm.spec b/netpbm.spec
index 0f58853..110e827 100644
--- a/netpbm.spec
+++ b/netpbm.spec
@@ -1,44 +1,45 @@
-Summary: A library for handling different graphics file formats
-Name: netpbm
-Version: 10.66.02
-Release: 5%{?dist}
+Summary: A library for handling different graphics file formats
+Name: netpbm
+Version: 11.13.00
+Release: 1%{?dist}
# See copyright_summary for details
-License: BSD and GPLv2 and IJG and MIT and Public Domain
-Group: System Environment/Libraries
+License: BSD-3-Clause AND GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later AND IJG AND MIT AND NTP AND PostgreSQL AND LicenseRef-MIT-CRL-Xim AND LicenseRef-Fedora-Public-Domain
URL: http://netpbm.sourceforge.net/
# Source0 is prepared by
-# svn checkout https://netpbm.svn.sourceforge.net/svnroot/netpbm/advanced netpbm-%{version}
-# svn checkout https://netpbm.svn.sourceforge.net/svnroot/netpbm/userguide netpbm-%{version}/userguide
-# svn checkout https://netpbm.svn.sourceforge.net/svnroot/netpbm/trunk/test netpbm-%{version}/test
+# svn checkout https://svn.code.sf.net/p/netpbm/code/advanced netpbm-%%{version}
+# svn checkout https://svn.code.sf.net/p/netpbm/code/userguide netpbm-%%{version}/userguide
+# svn checkout https://svn.code.sf.net/p/netpbm/code/trunk/test netpbm-%%{version}/test
# and removing the .svn directories ( find -name "\.svn" -type d -print0 | xargs -0 rm -rf )
-# and removing the ppmtompeg code, due to patents ( rm -rf netpbm-%{version}/converter/ppm/ppmtompeg/ )
-Source0: netpbm-%{version}.tar.xz
-Patch1: netpbm-time.patch
-Patch2: netpbm-message.patch
-Patch3: netpbm-security-scripts.patch
-Patch4: netpbm-security-code.patch
-Patch5: netpbm-nodoc.patch
-Patch6: netpbm-gcc4.patch
-Patch7: netpbm-bmptopnm.patch
-Patch8: netpbm-CAN-2005-2471.patch
-Patch9: netpbm-xwdfix.patch
-Patch11: netpbm-multilib.patch
-Patch13: netpbm-glibc.patch
-Patch15: netpbm-docfix.patch
-Patch16: netpbm-ppmfadeusage.patch
-Patch17: netpbm-fiasco-overflow.patch
-Patch20: netpbm-noppmtompeg.patch
-Patch21: netpbm-cmuwtopbm.patch
-Patch22: netpbm-pamtojpeg2k.patch
-Patch23: netpbm-manfix.patch
-Patch24: netpbm-ppmtopict.patch
-Patch25: netpbm-pnmtopclxl.patch
-Patch26: netpbm-werror.patch
-Patch27: netpbm-disable-pbmtog3.patch
-Patch28: netpbm-pnmtops.patch
-BuildRequires: libjpeg-devel, libpng-devel, libtiff-devel, flex
-BuildRequires: libX11-devel, python, jasper-devel, libxml2-devel
-BuildRequires: ghostscript-core
+Source0: netpbm-%{version}.tar.xz
+Patch1: netpbm-security-code.patch
+Patch2: netpbm-ppmfadeusage.patch
+Patch3: netpbm-CVE-2017-2587.patch
+Patch4: netpbm-python3.patch
+Patch5: netpbm-time.patch
+Patch6: netpbm-gcc4.patch
+Patch7: netpbm-bmptopnm.patch
+Patch8: netpbm-CAN-2005-2471.patch
+Patch9: netpbm-xwdfix.patch
+Patch10: netpbm-multilib.patch
+Patch11: netpbm-glibc.patch
+Patch12: netpbm-docfix.patch
+Patch13: netpbm-pamtojpeg2k.patch
+Patch14: netpbm-manfix.patch
+Patch15: netpbm-jasper.patch
+Patch16: netpbm-libdir-so.patch
+Patch17: netpbm-c99.patch
+Patch18: netpbm-shlib-ldflags.patch
+
+BuildRequires: make
+BuildRequires: libjpeg-devel, libpng-devel, libtiff-devel, flex, gcc, jbigkit-devel
+BuildRequires: libX11-devel, perl-generators, python3, jasper-devel, libxml2-devel
+BuildRequires: perl(Config), perl(Cwd), perl(English), perl(Fcntl), perl(File::Basename)
+BuildRequires: perl(strict)
+%if (0%{?fedora} && 0%{?fedora} < 28) || (0%{?rhel} || 0%{?rhel} <= 7)
+BuildRequires: ghostscript-core
+%else
+BuildRequires: ghostscript
+%endif
%description
The netpbm package contains a library of functions which support
@@ -47,9 +48,8 @@ programs for handling various graphics file formats, including .pbm
.ppm (portable pixmaps) and others.
%package devel
-Summary: Development tools for programs which will use the netpbm libraries
-Group: Development/Libraries
-Requires: netpbm = %{version}-%{release}
+Summary: Development tools for programs which will use the netpbm libraries
+Requires: netpbm = %{version}-%{release}
%description devel
The netpbm-devel package contains the header files and static libraries,
@@ -61,10 +61,9 @@ graphics file formats supported by the netpbm libraries. You'll also need
to have the netpbm package installed.
%package progs
-Summary: Tools for manipulating graphics files in netpbm supported formats
-Group: Applications/Multimedia
-Requires: ghostscript
-Requires: netpbm = %{version}-%{release}
+Summary: Tools for manipulating graphics files in netpbm supported formats
+Requires: ghostscript
+Requires: netpbm = %{version}-%{release}
%description progs
The netpbm-progs package contains a group of scripts for manipulating the
@@ -77,9 +76,8 @@ If you need to use these conversion scripts, you should install
netpbm-progs. You'll also need to install the netpbm package.
%package doc
-Summary: Documentation for tools manipulating graphics files in netpbm supported formats
-Group: Applications/Multimedia
-Requires: netpbm-progs = %{version}-%{release}
+Summary: Documentation for tools manipulating graphics files in netpbm supported formats
+Requires: netpbm-progs = %{version}-%{release}
%description doc
The netpbm-doc package contains a documentation in HTML format for utilities
@@ -89,36 +87,12 @@ If you need to look into the HTML documentation, you should install
netpbm-doc. You'll also need to install the netpbm-progs package.
%prep
-%setup -q
-%patch1 -p1 -b .time
-%patch2 -p1 -b .message
-%patch3 -p1 -b .security-scripts
-%patch4 -p1 -b .security-code
-%patch5 -p1 -b .nodoc
-%patch6 -p1 -b .gcc4
-%patch7 -p1 -b .bmptopnm
-%patch8 -p1 -b .CAN-2005-2471
-%patch9 -p1 -b .xwdfix
-%patch11 -p1 -b .multilib
-%patch13 -p1 -b .glibc
-%patch15 -p1 -b .docfix
-%patch16 -p1 -b .ppmfadeusage
-%patch17 -p1 -b .fiasco-overflow
-%patch20 -p1 -b .noppmtompeg
-%patch21 -p1 -b .cmuwtopbmfix
-%patch22 -p1 -b .pamtojpeg2kfix
-%patch23 -p1 -b .manfix
-%patch24 -p1 -b .ppmtopict
-%patch25 -p1 -b .pnmtopclxl
-%patch26 -p1 -b .werror
-%patch27 -p1 -b .disable-pbmtog3
-%patch28 -p1 -b .pnmtops
-
-sed -i 's/STRIPFLAG = -s/STRIPFLAG =/g' config.mk.in
+%autosetup -p1
rm -rf converter/other/jpeg2000/libjasper/
-sed -i -e 's/^SUBDIRS = libjasper/SUBDIRS =/' converter/other/jpeg2000/Makefile
+rm -rf converter/other/jbig/libjbig/
%build
+%set_build_flags
./configure < pgmtopbm
chmod 0755 pgmtopbm
popd
+%ldconfig_scriptlets
+
%check
pushd test
-export LD_LIBRARY_PATH=$RPM_BUILD_ROOT%{_libdir}
-export PBM_TESTPREFIX=$RPM_BUILD_ROOT%{_bindir}
-export PBM_BINPREFIX=$RPM_BUILD_ROOT%{_bindir}
+export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
+export PBM_TESTPREFIX=%{buildroot}%{_bindir}
+export PBM_BINPREFIX=%{buildroot}%{_bindir}
./Execute-Tests && exit 0
popd
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
%files
-%defattr(-,root,root)
-%doc doc/copyright_summary doc/COPYRIGHT.PATENT doc/GPL_LICENSE.txt doc/HISTORY README
-%{_libdir}/lib*.so*
+%doc doc/copyright_summary doc/COPYRIGHT.PATENT doc/HISTORY README
+%license doc/GPL_LICENSE.txt
+%{_libdir}/lib*.so.*
%files devel
-%defattr(-,root,root)
%dir %{_includedir}/netpbm
%{_includedir}/netpbm/*.h
%{_mandir}/man3/*
+%{_libdir}/lib*.so
%files progs
-%defattr(-,root,root)
%{_bindir}/*
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_datadir}/netpbm/
%files doc
-%defattr(-,root,root)
%doc userguide/*
%changelog
+* Thu Jan 08 2026 Josef Ridky - 11.13.00-1
+- New upstream release 11.13.00
+
+* Tue Oct 14 2025 Josef Ridky - 11.12.00-1
+- New upstream release 11.12.00
+
+* Thu Jul 24 2025 Fedora Release Engineering - 11.10.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
+
+* Tue Apr 08 2025 Josef Ridky - 11.10.00-1
+- New upstream release 11.10.00 (#2355869)
+
+* Thu Feb 06 2025 Josef Ridky - 11.09.00-2
+- add LDFLAGS patch (RHEL-70899)
+
+* Tue Jan 28 2025 Josef Ridky - 11.09.00-1
+- New upstream release 11.09.00 (#2218312)
+- Review and update license field
+
+* Fri Jan 17 2025 Fedora Release Engineering - 11.02.00-10
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
+
+* Fri Dec 13 2024 Lukáš Zaoral - 11.02.00-9
+- build netpbm with correct LDFLAGS (RHEL-70899)
+
+* Mon Sep 02 2024 Miroslav Suchý - 11.02.00-8
+- convert license to SPDX
+
+* Thu Jul 18 2024 Fedora Release Engineering - 11.02.00-7
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
+
+* Thu Jan 25 2024 Fedora Release Engineering - 11.02.00-6
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
+
+* Sun Jan 21 2024 Florian Weimer - 11.02.00-5
+- GCC 14 compatibility fixes:
+ Drop netpbm-cmuwtopbm.patch to fix an out-of-bounds stack write (#2259450)
+ Stub out unused converter/other/jpeg2000/libjasper_compat.c (#2259448)
+
+* Sun Jan 21 2024 Fedora Release Engineering - 11.02.00-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
+
+* Tue Nov 28 2023 Orion Poplawski - 11.02.00-3
+- Rebuild for jasper 4.1
+
+* Thu Jul 20 2023 Fedora Release Engineering - 11.02.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
+
+* Mon Mar 27 2023 Josef Ridky - 11.02.00-1
+- New upstream release 11.02.00 (#2157125)
+
+* Thu Jan 19 2023 Fedora Release Engineering - 11.01.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
+
+* Mon Jan 02 2023 Josef Ridky - 11.01.00-1
+- New upstream release 11.01.00 (#2157125)
+
+* Fri Dec 02 2022 Florian Weimer - 11.00.00-2
+- Port downstream-specific patches to C99
+
+* Tue Oct 04 2022 Josef Ridky - 11.00.00-1
+- New upstream release 11.00.00 (#2130384)
+
+* Fri Jul 22 2022 Fedora Release Engineering - 10.99.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
+
+* Tue Jun 28 2022 Josef Ridky - 10.99.00-1
+- New upstream release 10.99.00 (#2068865)
+- Use %%set_build_flags to set environment variables
+
+* Sun Feb 13 2022 Josef Ridky - 10.97.00-4
+- Bump spec for new jasper
+
+* Fri Feb 11 2022 Josef Ridky - 10.97.00-3
+- Rebuild for new jasper
+
+* Thu Jan 20 2022 Fedora Release Engineering - 10.97.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
+
+* Mon Jan 03 2022 Josef Ridky - 10.97.00-1
+- New upstream release 10.97.00 (#2035806)
+
+* Mon Oct 04 2021 Josef Ridky - 10.96.00-1
+- New upstream release 10.96.00 (#2007871)
+
+* Thu Jul 22 2021 Fedora Release Engineering - 10.95.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
+
+* Thu Jul 15 2021 Josef Ridky - 10.95.00-1
+- New upstream release 10.95.00 (#1977974)
+
+* Wed Mar 31 2021 Josef Ridky - 10.94.05-1
+- New upstream release 10.94.05 (#1943837)
+
+* Mon Jan 25 2021 Josef Ridky - 10.93.00-1
+- New upstream release 10.93.00 (#1911159)
+
+* Wed Oct 07 2020 Josef Ridky - 10.92.00-1
+- New upstream release 10.92.00 (#1851753)
+
+* Tue Jul 28 2020 Fedora Release Engineering - 10.90.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
+
+* Thu Mar 26 2020 Josef Ridky - 10.90.00-1
+- New upstream release 10.90.00 (#1817279)
+
+* Wed Mar 25 2020 Jitka Plesnikova - 10.89.00-3
+- Add perl dependencies for build
+
+* Wed Jan 29 2020 Fedora Release Engineering - 10.89.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
+
+* Mon Jan 06 2020 Josef Ridky - 10.89.00-1
+- New upstream release 10.89.00 (#1787801)
+
+* Mon Dec 09 2019 Josef Ridky - 10.88.00-1
+- New upstream release (#1756647)
+
+* Wed Aug 21 2019 Josef Ridky - 10.87.00-1
+- New upstream release (#1725280)
+
+* Thu Jul 25 2019 Fedora Release Engineering - 10.86.00-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
+
+* Wed Apr 17 2019 Josef Ridky - 10.86.00-2
+- Enable MPEG and MPEG-2 support (#1700164)
+
+* Mon Apr 01 2019 Josef Ridky - 10.86.00-1
+- New upstream release (#1694351)
+
+* Tue Feb 12 2019 Ralf Corsépius - 10.84.03-3
+- Package %%{_libdir}/*.so (RHBZ#1676370).
+
+* Fri Feb 01 2019 Fedora Release Engineering - 10.84.03-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
+
+* Fri Nov 23 2018 Josef Ridky - 10.84.03-1
+- New upstream release (#1634256)
+
+* Wed Nov 21 2018 Josef Ridky - 10.83.01-2
+- Use system version of jasper and jbigkit library (#1651965)
+
+* Mon Jul 23 2018 Josef Ridky - 10.83.01-1
+- New upstream release 10.83.01 (#1596970)
+
+* Fri Jul 13 2018 Fedora Release Engineering - 10.82.00-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
+
+* Mon Jun 04 2018 Josef Ridky - 10.82.00-3
+- Backport unimplemented fixes from 10.79.00 (#1585695)
+
+* Wed Apr 11 2018 Rafael Santos - 10.82.00-2
+- Use standard Fedora build and linker flags (bug #1543858)
+
+* Tue Mar 27 2018 Josef Ridky - 10.82.00-1
+- New upstream release 10.82.00 (#1560330)
+
+* Mon Feb 26 2018 Josef Ridky - 10.81.00-4
+- spec clean up
+- build against Python3
+
+* Thu Feb 08 2018 Fedora Release Engineering - 10.81.00-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
+
+* Mon Jan 22 2018 Josef Ridky - 10.81.00-2
+- change ghostscript requirement
+
+* Wed Jan 03 2018 Josef Ridky - 10.81.00-1
+- New upstream release 10.81.00 (#1529904)
+- update spec file
+
+* Thu Oct 19 2017 Josef Ridky - 10.80.00-2
+- Rebuilt for python package
+
+* Mon Oct 02 2017 Josef Ridky - 10.80.00-1
+- New upstream release 10.80.00 (#1496797)
+
+* Thu Aug 03 2017 Fedora Release Engineering - 10.79.00-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
+
+* Wed Jul 26 2017 Fedora Release Engineering - 10.79.00-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
+
+* Mon Jul 03 2017 Josef Ridky - 10.79.00-1
+- New upstream release 10.79.00 (#1466772)
+
+* Wed Mar 29 2017 Josef Ridky - 10.78.00-1
+- New upstream release 10.78.00
+
+* Wed Feb 08 2017 Josef Ridky - 10.77.00-3
+- fix CVE-2017-2586, CVE-2017-2587 (#1419545)
+- fix CVE-2017-5849 (#1419650)
+
+* Mon Jan 23 2017 Josef Ridky - 10.77.00-2
+- fix #1404757 - add copyright_summary to doc section
+
+* Mon Jan 23 2017 Josef Ridky - 10.77.00-1
+- New upstream release 10.77.00 (#1408611)
+
+* Mon Dec 5 2016 Josef Ridky - 10.76.00-2
+- set Provides: bundled for jasper and jbigkit library (#1395716)
+
+* Thu Nov 10 2016 Josef Ridky - 10.76.00-1
+- Update to the latest upstream release 10.76.00 (#1393713)
+
+* Thu Jul 28 2016 Josef Ridky - 10.75.99-1
+- Update to the latest upstream release 10.75.99 (#1361103)
+
+* Thu Feb 04 2016 Fedora Release Engineering - 10.71.02-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
+
+* Mon Aug 10 2015 Petr Hracek - 10.71.02-1
+- Update to the latest upstream release (#1252352)
+
+* Thu Aug 06 2015 Petr Hracek - 10.66.02-7
+- remove doc/copyright_summary (#1219743)
+
+* Wed Jun 17 2015 Fedora Release Engineering - 10.66.02-6
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
+
* Tue Jan 20 2015 Petr Hracek - 10.66.02-5
- Moving libnetpbm.so from netpbm-devel to netpbm (#1180811)
@@ -849,7 +1030,7 @@ rm -rf $RPM_BUILD_ROOT
- fix segfault in ppmtompeg when encoding jpeg images (#185970)
* Mon Apr 3 2006 Jindrich Novy 10.32-2
-- fix broken symlink in upstream: pnmsdepth -> pamdepth (#187667)
+- fix broken symlink in upstream: pnmsdepth -> pamdepth (#187667)
* Tue Feb 28 2006 Jindrich Novy 10.32-1
- update to 10.32
diff --git a/netpbm2tar.sh b/netpbm2tar.sh
new file mode 100755
index 0000000..b02e6ad
--- /dev/null
+++ b/netpbm2tar.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Source0 is prepared by
+# svn checkout https://svn.code.sf.net/p/netpbm/code/advanced netpbm-%{version}
+# svn checkout https://svn.code.sf.net/p/netpbm/code/userguide netpbm-%{version}/userguide
+# svn checkout https://svn.code.sf.net/p/netpbm/code/trunk/test netpbm-%{version}/test
+# and removing the .svn directories ( find -name "\.svn" -type d -print0 | xargs -0 rm -rf )
+
+VERSION=$1
+if [[ -z $VERSION ]]; then
+ echo "Version is missing as argument"
+ exit 1
+fi
+NETPBM_NAME="netpbm-$VERSION"
+TEMP_DIR="/var/tmp/netpbm"
+TARBALL="$TEMP_DIR/$NETPBM_NAME.tar.xz"
+mkdir -p $TEMP_DIR
+pushd $TEMP_DIR
+svn checkout https://svn.code.sf.net/p/netpbm/code/advanced $NETPBM_NAME
+svn checkout https://svn.code.sf.net/p/netpbm/code/userguide $NETPBM_NAME/userguide
+svn checkout https://svn.code.sf.net/p/netpbm/code/trunk/test $NETPBM_NAME/test
+find -name '\.svn' -type d -print0 | xargs -0 rm -rf
+tar -cJvf $NETPBM_NAME.tar.xz $NETPBM_NAME
+rm -rf $NETPBM_NAME/
+popd
+if [[ -f "$TARBALL" ]]; then
+ cp $TARBALL .
+ rm $TARBALL
+fi
+exit 0
diff --git a/sources b/sources
index 1f41b8d..4e39977 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-dcb7de91384d630eb399e48c71158f3d netpbm-10.66.02.tar.xz
+SHA512 (netpbm-11.13.00.tar.xz) = 0914061c7c8d638147afb76cbf23609b3ae43aca4120e4297fd5db6887d5381469d6944cdbdc1c66d26f54ec68d62355693c08b830dde823061e37c51480b678