netpbm: update to 11.05.01.

This commit is contained in:
Leah Neukirchen 2024-01-16 14:50:42 +01:00
parent bc02b072ac
commit 59dd696517
2 changed files with 5 additions and 156 deletions

View File

@ -176,129 +176,6 @@ diff -up netpbm-10.58.01/converter/ppm/ppmtomitsu.c.security-code netpbm-10.58.0
medias.maxcols *= 2;
medias.maxrows *= 2;
}
diff -up netpbm-10.58.01/converter/ppm/ppmtopj.c.security-code netpbm-10.58.01/converter/ppm/ppmtopj.c
--- netpbm-10.58.01/converter/ppm/ppmtopj.c.security-code 2012-04-09 15:31:44.000000000 +0200
+++ netpbm-10.58.01/converter/ppm/ppmtopj.c 2012-04-09 15:40:03.212619677 +0200
@@ -179,6 +179,7 @@ char *argv[];
pixels = ppm_readppm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
+ overflow2(cols,2);
obuf = (unsigned char *) pm_allocrow(cols, sizeof(unsigned char));
cbuf = (unsigned char *) pm_allocrow(cols * 2, sizeof(unsigned char));
diff -up netpbm-10.58.01/converter/ppm/ppmtopjxl.c.security-code netpbm-10.58.01/converter/ppm/ppmtopjxl.c
--- netpbm-10.58.01/converter/ppm/ppmtopjxl.c.security-code 2012-04-09 15:31:44.000000000 +0200
+++ netpbm-10.58.01/converter/ppm/ppmtopjxl.c 2012-04-09 15:40:03.212619677 +0200
@@ -276,6 +276,8 @@ main(int argc, const char * argv[]) {
pm_error("image too large; reduce with ppmscale");
if (maxval > 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 @@
#include <math.h>
#include <string.h>
+#include <stdlib.h>
#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;y<rows;y++) {
u1 * row;
@@ -347,6 +349,7 @@ create4Bitmap (pixel ** const pa, int co
MALLOCARRAY_NOFAIL(rowData, rows);
icBitmap->xBytes = xBytes;
icBitmap->data = rowData;
+ overflow2(xBytes, rows);
icBitmap->size = xBytes * rows;
for (y=0;y<rows;y++) {
@@ -407,6 +410,7 @@ create8Bitmap (pixel ** const pa, int co
MALLOCARRAY_NOFAIL(rowData, rows);
icBitmap->xBytes = xBytes;
icBitmap->data = rowData;
+ overflow2(xBytes, rows);
icBitmap->size = xBytes * rows;
for (y=0;y<rows;y++) {
@@ -714,6 +718,10 @@ addEntryToIcon(MS_Ico const MSIcon
entry->bitcount = 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
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");
@@ -314,6 +315,7 @@ genCmap(colorhist_vector const chv,
unsigned int charsPerPixel;
unsigned int xpmMaxval;
+ 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 )
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" );
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
@ -470,34 +347,6 @@ 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-9.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 <alan@redhat.com>
*/
/*
* 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);
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
--- netpbm-10.58.01/lib/libpbm1.c.orig 2014-06-16 21:12:28.499230631 -0400
+++ netpbm-10.58.01/lib/libpbm1.c 2014-06-16 21:12:55.932519324 -0400
@@ -78,6 +78,7 @@

View File

@ -1,10 +1,10 @@
# Template file for 'netpbm'
pkgname=netpbm
# from http://svn.code.sf.net/p/netpbm/code/advanced/doc/HISTORY
version=11.04.05
version=11.05.01
revision=1
_githash=d21c9b3ce1847ee69ace9603aced3c35fbedfeee
_githash_guide=a389ddc05a66c41cf88bb95387a81607effdfdaf
_githash=f900db12f6cd4e361b37cf2c6739ac469b6fcafb
_githash_guide=b2dd0abf08166bfd865f9e20234116d36384b746
create_wrksrc=yes
build_wrksrc="netpbm-mirror-${_githash}"
hostmakedepends="flex perl pkg-config python3"
@ -16,8 +16,8 @@ license="BSD-3-Clause,GPL-2.0-only,custom:netpbm"
homepage="http://netpbm.sourceforge.net/"
distfiles="https://github.com/leahneukirchen/netpbm-mirror/archive/${_githash}.tar.gz
https://github.com/leahneukirchen/netpbm-mirror/archive/${_githash_guide}.tar.gz"
checksum="41096f53e620d956fcd39627914b258f52ae0af045e19b21cd8726cce4a70707
a8e0a7a27b6747a6eeebf9956004a6ea71c7f5b55759581e1a70e2319e60e08e"
checksum="6af106647ebc84fa96a6b34690858d29a0b6650906afd31294b811dadd22b504
5b68629856bd36b9a57add8cb3b4c76314c34840012dcd1506b6cc254b6f5b7a"
post_extract() {
cd $build_wrksrc