extra/netpbm to 10.86.39-1

This commit is contained in:
Kevin Mihelich 2023-12-13 20:09:17 +00:00
parent 08a34ab4cf
commit 03388e83c0
7 changed files with 118 additions and 209 deletions

39
extra/netpbm/.SRCINFO Normal file
View file

@ -0,0 +1,39 @@
pkgbase = netpbm
pkgdesc = A toolkit for manipulation of graphic images
pkgver = 10.86.39
pkgrel = 1
url = http://netpbm.sourceforge.net/
arch = x86_64
license = custom
license = BSD
license = GPL
license = LGPL
makedepends = subversion
depends = bash
depends = gcc-libs
depends = glibc
depends = jbigkit
depends = libjpeg-turbo
depends = libpng
depends = libtiff
depends = libxml2
depends = perl
depends = zlib
options = !makeflags
source = https://downloads.sourceforge.net/project/netpbm/super_stable/10.86.39/netpbm-10.86.39.tgz
source = https://sources.archlinux.org/other/packages/netpbm/netpbm-doc-31Jan2014.tar.xz
source = https://sources.archlinux.org/other/packages/netpbm/netpbm-doc-31Jan2014.tar.xz.sig
source = netpbm-CAN-2005-2471.patch
source = netpbm-security-code.patch
source = netpbm-security-scripts.patch
source = reproducible-man-gzip.patch
validpgpkeys = 5357F3B111688D88C1D88119FCF2CB179205AC90
sha256sums = 424ac920a5e9e90049424a46383276e04c8d6b824b7b2e908f250d59dfa8c12b
sha256sums = 74bcf840ee643c6917330c382484010cb99c004a3fcf05391bebcac63815acb3
sha256sums = SKIP
sha256sums = 7348274b72b8285add042d0f45d124c9833206ee3440bd1846cfc792b9b4d5e5
sha256sums = 698645215d46bcee515d75847fc550ce99c5fcb6fae63dacdba1d773f327c80e
sha256sums = 5ee27b4187577cbb9e85f6b36c5e5a421e03927f9195f888be7be2b647a5ac9d
sha256sums = b0be94fbfbf247552c5cc3f1cdd93e2d549f59c3d218350ccc1bea44e9bebc9b
pkgname = netpbm

View file

@ -4,8 +4,8 @@
# - add armv7h and aarch64 for -fPIC flag
pkgname=netpbm
pkgver=10.73.43
pkgrel=2
pkgver=10.86.39
pkgrel=1
pkgdesc="A toolkit for manipulation of graphic images"
arch=('x86_64')
license=('custom' 'BSD' 'GPL' 'LGPL')
@ -28,15 +28,14 @@ options=('!makeflags')
source=(https://downloads.sourceforge.net/project/netpbm/super_stable/$pkgver/netpbm-$pkgver.tgz
https://sources.archlinux.org/other/packages/netpbm/netpbm-doc-31Jan2014.tar.xz{,.sig}
netpbm-CAN-2005-2471.patch netpbm-security-code.patch netpbm-security-scripts.patch
reproducible-man-gzip.patch use-source-date-epoch.patch)
sha256sums=('f9fd9a7f932258224d1925bfce61396a15e0fad93e3853d6324ac308d1adebf8'
reproducible-man-gzip.patch)
sha256sums=('424ac920a5e9e90049424a46383276e04c8d6b824b7b2e908f250d59dfa8c12b'
'74bcf840ee643c6917330c382484010cb99c004a3fcf05391bebcac63815acb3'
'SKIP'
'991aba7897e0710687369b4e2edfba1397ecd77d62578eac496afbc47b5ca970'
'343a72eb67edb338bc593d823ced770a0fe44c4c1fa4f4ac1934b84da4431579'
'2c397588d9cba2c40dee55c07713d5e77e0e04245db939fdc1962d7de4cf4a33'
'8e3efdb4fcbfdc8e9a5c8e9663c7d6b9ecef3a2379ce38d2acc5669c339f6814'
'68055341833f482c6910a56c2fdfe046978a1a92fd8442a2a9209c82ce3e4d13')
'7348274b72b8285add042d0f45d124c9833206ee3440bd1846cfc792b9b4d5e5'
'698645215d46bcee515d75847fc550ce99c5fcb6fae63dacdba1d773f327c80e'
'5ee27b4187577cbb9e85f6b36c5e5a421e03927f9195f888be7be2b647a5ac9d'
'b0be94fbfbf247552c5cc3f1cdd93e2d549f59c3d218350ccc1bea44e9bebc9b')
validpgpkeys=('5357F3B111688D88C1D88119FCF2CB179205AC90')
prepare() {
@ -46,9 +45,6 @@ prepare() {
patch -p1 < ../netpbm-security-code.patch
patch -p1 < ../netpbm-security-scripts.patch
patch -p1 < ../reproducible-man-gzip.patch
patch -p1 < ../use-source-date-epoch.patch
# sed -i 's|#!/usr/bin/python|#!/usr/bin/python2|' buildtools/makeman
# sed -i 's|@python|@python2|' buildtools/manpage.mk
cp config.mk.in config.mk
[ "${CARCH}" = 'x86_64' ] && echo 'CFLAGS_SHLIB = -fPIC' >> config.mk
@ -79,12 +75,6 @@ package() {
cd $pkgname-$pkgver
make pkgdir="${pkgdir}/usr" PKGMANDIR=share/man install-run install-dev
# Removing dummy man pages
rm "${pkgdir}"/usr/share/man/man{1,3,5}/*
# make MAKEMAN="${srcdir}/$pkgname-$pkgver/buildtools/makeman" MANDIR="${pkgdir}/usr/share/man" \
# -C ../doc -f "${srcdir}/$pkgname-$pkgver/buildtools/manpage.mk" installman
# Replace obsolete utility
echo -e '#!/bin/sh\npamditherbw $@ | pamtopnm\n' > "${pkgdir}/usr/bin/pgmtopbm"

View file

@ -1,6 +1,6 @@
--- netpbm-10.29/converter/other/pstopnm.c.CAN-2005-2471 2005-08-15 02:39:46.000000000 +0200
+++ netpbm-10.29/converter/other/pstopnm.c 2005-08-16 15:38:15.000000000 +0200
@@ -818,11 +818,11 @@
@@ -896,11 +896,11 @@
ghostscriptProg, arg0,
deviceopt, outfileopt, gopt, ropt, textalphabitsopt,
"-q", "-dNOPAUSE",

View file

@ -32,13 +32,13 @@ index aac7479..5f1a51a 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 );
else
type = PPM_TYPE;
+ overflow_add(cols, padright);
pnm_writepnminit( stdout, cols, rows, MAXVAL, type, 0 );
{
/* allocate input row data structure */
int plane;
diff --git a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c
index ab3b18e..c324b86 100644
--- a/converter/other/jpegtopnm.c
@ -318,21 +318,21 @@ index 2f8a42b..1c8d236 100644
--- a/converter/pbm/pbmtoppa/pbm.c
+++ b/converter/pbm/pbmtoppa/pbm.c
@@ -106,6 +106,7 @@ int pbm_readline(pbm_stat* pbm,unsigned char* data)
return 0;
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) {
@@ -185,6 +186,7 @@ void pbm_unreadline (pbm_stat *pbm, void *data)
case P4:
+ overflow_add(pbm->width, 7);
tmp=(pbm->width+7)/8;
tmp2=fread(data,1,tmp,pbm->fptr);
if(tmp2 == tmp)
@@ -130,6 +131,7 @@ void pbm_unreadline (pbm_stat *pbm, void *data)
return;
pbm->unread = 1;
+ overflow_add(pbm->width, 7);
pbm->revdata = malloc ((pbm->width+7)/8);
memcpy (pbm->revdata, data, (pbm->width+7)/8);
pbm->current_line--;
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 --git a/converter/pbm/pbmtoppa/pbmtoppa.c b/converter/pbm/pbmtoppa/pbmtoppa.c
index f43c08a..98e0284 100644
--- a/converter/pbm/pbmtoppa/pbmtoppa.c
@ -500,14 +500,14 @@ index 662be0b..2a86efc 100644
MALLOCARRAY_NOFAIL(bluetable, bluemaxval +1);
@@ -1784,7 +1805,9 @@ PCHG_ConvertSmall(PCHG, cmap, mask, datasize)
ChangeCount32 = *data++;
datasize -= 2;
remDataSize -= 2;
+ 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;
for (i = 0; i < changes; ++i) {
if (totalchanges >= pchgP->TotalChanges) goto fail;
if (remDataSize < 2) goto fail;
@@ -2049,6 +2072,9 @@ read_pchg(FILE * const ifP,
cmap->mp_change[i] = NULL;
if( PCHG.StartLine < 0 ) {
@ -579,50 +579,36 @@ diff --git a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c
index 7b694fb..62ce77e 100644
--- a/converter/ppm/pjtoppm.c
+++ b/converter/ppm/pjtoppm.c
@@ -127,20 +127,22 @@ main(argc, argv)
@@ -127,11 +127,15 @@ 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 (row >= rowsX || image == NULL) {
- if (row >= rowsX)
+ if (row >= rowsX) {
+ overflow_add(rowsX, 100);
rowsX += 100;
+ }
+
if (image == NULL) {
- MALLOCARRAY(image, rows * planes);
- MALLOCARRAY(imlen, rows * planes);
- MALLOCARRAY(image, uintProduct(rowsX, planes));
- MALLOCARRAY(imlen, uintProduct(rowsX, planes));
+ image = (unsigned char **)
+ malloc3(rows , planes , sizeof(unsigned char *));
+ imlen = (int *) malloc3(rows , planes, sizeof(int));
}
else {
- image = (unsigned char **)
- realloc(image,
- rows * planes *
- sizeof(unsigned char *));
- imlen = (int *)
- realloc(imlen, rows * planes * sizeof(int));
- }
+ overflow2(rows,planes);
+ image = (unsigned char **)
+ realloc2(image, rows * planes,
+ sizeof(unsigned char *));
+ imlen = (int *) realloc2(imlen, rows * planes, sizeof(int)); }
}
if (image == NULL || imlen == NULL)
pm_error("out of memory");
+ malloc3(rowsX , planes , sizeof(unsigned char *));
+ imlen = (int *) malloc3(rowsX , planes, sizeof(int));
} else {
REALLOCARRAY(image, uintProduct(rowsX, planes));
REALLOCARRAY(imlen, uintProduct(rowsX, planes));
@@ -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];
col += 2)
for (cmd = image[plane + row * planes][col],
val = image[plane + row * planes][col+1];
- cmd >= 0 && i < newcols; cmd--, i++)
+ cmd >= 0 && i < newcols; cmd--, i++) {
buf[i] = val;
+ overflow_add(i, 1);
+ }
cols = cols > i ? cols : i;
free(image[p + r * planes]);
cols = MAX(cols, i);
free(image[plane + row * planes]);
/*
@@ -224,6 +228,7 @@ main(argc, argv)
image[p + r * planes] = (unsigned char *) realloc(buf, i);
@ -869,13 +855,13 @@ index f49c8d9..580e5e0 100644
--- a/editor/pbmreduce.c
+++ b/editor/pbmreduce.c
@@ -94,6 +94,7 @@ main( argc, argv )
if (halftone == QT_FS) {
unsigned int col;
/* Initialize Floyd-Steinberg. */
unsigned int col;
+ overflow_add(newcols, 2);
MALLOCARRAY(thiserr, newcols + 2);
MALLOCARRAY(nexterr, newcols + 2);
if (thiserr == NULL || nexterr == NULL)
MALLOCARRAY(fsP->thiserr, newcols + 2);
MALLOCARRAY(fsP->nexterr, newcols + 2);
diff --git a/editor/pnmgamma.c b/editor/pnmgamma.c
index b357b0d..ec612d3 100644
--- a/editor/pnmgamma.c
@ -939,7 +925,7 @@ index b2448cb..b924120 100644
MALLOCARRAY(fserrP->thiserr, pamP->depth);
@@ -465,6 +466,7 @@ floydInitRow(struct pam * const pamP, struct fserr * const fserrP) {
int col;
unsigned int col;
+ overflow_add(pamP->width, 2);
for (col = 0; col < pamP->width + 2; ++col) {
@ -1004,42 +990,6 @@ index 6cb8d3a..6f4bde9 100644
MALLOCARRAY(hist, inpam.maxval + 1);
if (hist == NULL)
pm_error("Unable to allocate memory for histogram.");
diff --git a/generator/pbmtext.c b/generator/pbmtext.c
index 9f4366d..445d718 100644
--- a/generator/pbmtext.c
+++ b/generator/pbmtext.c
@@ -96,12 +96,14 @@ parseCommandLine(int argc, const char ** argv,
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 --git a/lib/libpam.c b/lib/libpam.c
index cc6368e..4e10572 100644
--- a/lib/libpam.c
@ -1143,7 +1093,7 @@ index e9f1405..da54391 100644
+void __overflow2(int, int);
+void overflow3(int, int, int);
+void overflow_add(int, int);
+
+void *realloc2(void*, int, int);
#endif
diff --git a/other/pnmcolormap.c b/other/pnmcolormap.c

View file

@ -2,18 +2,6 @@ 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"
@ -35,38 +23,10 @@ index acf8813..335312a 100755
+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 \
@ -348,22 +308,5 @@ index 027fc79..8eb094f 100755
+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

View file

@ -2,15 +2,15 @@ diff -aur netpbm-10.73.31.old/buildtools/manpage.mk netpbm-10.73.31/buildtools/m
--- netpbm-10.73.31.old/buildtools/manpage.mk 2020-05-28 18:41:20.400790506 +0200
+++ netpbm-10.73.31/buildtools/manpage.mk 2020-05-28 18:50:50.444143414 +0200
@@ -388,9 +388,9 @@
# This will install the generated man pages
installman:
.PHONY : installman
installman: report
set -x
- for f in netpbm.1 $(MAN1); do if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man1/$$f.gz; fi; done
- for f in $(MAN3); do if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man3/$$f.gz; fi; done
- for f in $(MAN5); do if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man5/$$f.gz; fi; done
+ for f in netpbm.1 $(MAN1); do if [ -f $$f ]; then gzip -n <$$f >$(MANDIR)/man1/$$f.gz; fi; done
+ for f in $(MAN3); do if [ -f $$f ]; then gzip -n <$$f >$(MANDIR)/man3/$$f.gz; fi; done
+ for f in $(MAN5); do if [ -f $$f ]; then gzip -n <$$f >$(MANDIR)/man5/$$f.gz; fi; done
- for f in $(wildcard $(MAN1)); do if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man1/$$f.gz; fi; done
- for f in $(wildcard $(MAN3)); do if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man3/$$f.gz; fi; done
- for f in $(wildcard $(MAN5)); do if [ -f $$f ]; then gzip <$$f >$(MANDIR)/man5/$$f.gz; fi; done
+ for f in $(wildcard $(MAN1)); do if [ -f $$f ]; then gzip -n <$$f >$(MANDIR)/man1/$$f.gz; fi; done
+ for f in $(wildcard $(MAN3)); do if [ -f $$f ]; then gzip -n <$$f >$(MANDIR)/man3/$$f.gz; fi; done
+ for f in $(wildcard $(MAN5)); do if [ -f $$f ]; then gzip -n <$$f >$(MANDIR)/man5/$$f.gz; fi; done
# This will uninstall them
uninstallman:
# This will uninstall the man pages.

View file

@ -1,13 +0,0 @@
Only in netpbm-10.73.31/buildtools/: depend.mk
diff -aur netpbm-10.73.31.old/buildtools/stamp-date netpbm-10.73.31/buildtools/stamp-date
--- netpbm-10.73.31.old/buildtools/stamp-date 2020-05-30 17:34:29.833395465 +0200
+++ netpbm-10.73.31/buildtools/stamp-date 2020-05-30 17:48:52.910091897 +0200
@@ -9,7 +9,7 @@
# documentation. This software is provided "as is" without express or
# implied warranty.
#
-DATE=$(date)
+DATE="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}")"
LOGNAME_OR_UNKNOWN=${LOGNAME:-UNKNOWN}
USER=${USER:-$LOGNAME_OR_UNKNOWN}
if [ "$USER" = "UNKNOWN" ]; then