diff options
author | Patrick J Volkerding <volkerdi@slackware.com> | 2018-11-13 05:15:29 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2018-11-13 17:59:46 +0100 |
commit | 2520b90f18ab408818b967f77ef38c1be85de634 (patch) | |
tree | c07e9cf84c06eb9e4a8981d21cfc66fab58416d5 /source/l/netpbm | |
parent | cb1323a95c7d3275677760efd96a3eb9824c8aa8 (diff) | |
download | current-2520b90f18ab408818b967f77ef38c1be85de634.tar.gz current-2520b90f18ab408818b967f77ef38c1be85de634.tar.xz |
Tue Nov 13 05:15:29 UTC 201820181113051529
d/python-setuptools-40.6.1-x86_64-1.txz: Upgraded.
l/M2Crypto-0.31.0-x86_64-1.txz: Upgraded.
l/SDL2-2.0.9-x86_64-2.txz: Rebuilt.
Fixed use of SDL_syswm.h with SDL_PROTOTYPES_ONLY in C++ mode.
Thanks to orbea.
l/libtiff-4.0.10-x86_64-1.txz: Upgraded.
This update fixes some denial of service security issues.
For more information, see:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-7456
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-8905
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-10779
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-10963
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-18661
(* Security fix *)
l/netpbm-10.84.02-x86_64-1.txz: Upgraded.
n/net-snmp-5.8-x86_64-2.txz: Rebuilt.
Recompiled to link the perl modules to the new libraries. Thanks to th_r.
Diffstat (limited to 'source/l/netpbm')
25 files changed, 3861 insertions, 715 deletions
diff --git a/source/l/netpbm/config.mk b/source/l/netpbm/config.mk deleted file mode 100644 index 9f7089a53..000000000 --- a/source/l/netpbm/config.mk +++ /dev/null @@ -1,661 +0,0 @@ -####This file was automatically created by 'configure.' -####Many variables are set twice -- a generic setting, then -####a system-specific override at the bottom of the file. -#### -# This is a make file inclusion, to be included in all the Netpbm make -# files. - -# This file is meant to contain variable settings that customize the -# build for a particular target system configuration. - -# The distribution contains the file config.mk.in. You edit -# config.mk.in in ways relevant to your particular environment -# to create config.mk. The "configure" program will do this -# for you in simple cases. - -# Some of the variables that the including make file must set for this -# file to work: -# -# SRCDIR: The directory at the top of the Netpbm source tree. Note that -# this is typically a relative directory, and it must be relative to the -# make file that includes this file. - -DEFAULT_TARGET = nonmerge -#DEFAULT_TARGET = merge - -# Fiasco has some special requirements that make it fail to compile on -# some systems, and since it isn't very important, just set this to "N" -# and skip it on those systems unless you want to debug it and fix it. -# OpenBSD: -#BUILD_FIASCO = N -BUILD_FIASCO = Y - -# The following are commands for the build process to use. These values -# do not get built into anything. - -# The C compiler (including macro preprocessor) -#CC = gcc -# Note that 'cc' is usually an alias for whatever is the main compiler -# on a system, e.g. the GNU Compiler on Linux. -CC = cc - -# The linker. -LD = $(CC) -#LD = ld -#Tru64: -#LD = cc -#LD = gcc - -#If the linker identified above is a compiler that invokes a linker -#(as in 'cc foo.o -o foo'), set LINKERISCOMPILER. The main difference is -#that we expect a compiler to take linker options in the '-Wl,-opt1,val1' -#syntax whereas the actual linker would take '-opt1 val1'. -LINKERISCOMPILER=Y -#If $(LD) is 'ld': -#LINKERISCOMPILER=N - -#LINKER_CAN_DO_EXPLICIT_LIBRARY means the linker specified above can -#take a library as just another link object argument, as in 'ld -#pnmtojpeg.o /usr/local/lib/libjpeg.so ...' as opposed to requiring a -#-l option as in 'ld pnmtojpeg.o -L/usr/local/lib -l jpeg'. -#This variable controls how 'libopt' gets built. Note that with some -#linkers, you can specify a shared library explicitly, but then it has -#to live in that exact place at run time. That's not good enough for us. - -LINKER_CAN_DO_EXPLICIT_LIBRARY=N -#GNU: -#LINKER_CAN_DO_EXPLICIT_LIBRARY=Y - -# This is the name of the header file that declares the types -# uint32_t, etc. This name is used as #include $(INTTYPES_H) . -# Set to null if the types come automatically without including anything. - -# We have a report (2005.09.17) that on IRIX 5.3 with the native IDO -# cc, inttypes.h and sys/types.h conflict (and Netpbm programs include -# sys/types for other things), so for that environment, <inttypes.h> -# won't work, but "inttypes_netpbm.h" might. - -INTTYPES_H = <inttypes.h> -# Linux libc5: -#INTTYPES_H = <types.h> -# Solaris: -# Solaris has <sys/inttypes.h>, but it doesn't define int_fast2_t, etc. -#INTTYPES_H = "inttypes_netpbm.h" -# Others: -#INTTYPES_H = <sys/stdint.h> -#INTTYPES_H = <sys/types.h> -# The automatically generated Netpbm version: -#INTTYPES_H = "inttypes_netpbm.h" - -# HAVE_INT64 tells whether, assuming you include the header indicated by -# INTTYPES_H, you have the int64_t type and related stuff. (If you don't -# the build will omit certain code that does 64 bit computations). -HAVE_INT64 = Y -#HAVE_INT64 = N - -# CC and LD are for building the Netpbm programs, which are not necessarily -# intended to run on the same system on which Make is running. But when we -# build a build tool such as Libopt, it is meant to run only on the same -# system on which the Make is running. The variables below define programs -# to use to compile and link build tools. -CC_FOR_BUILD = $(CC) -LD_FOR_BUILD = $(LD) -CFLAGS_FOR_BUILD = $(CFLAGS) -LDFLAGS_FOR_BUILD = $(LDFLAGS) - -# MAKE is set automatically by Make to what was used to invoke Make. - -INSTALL = $(SRCDIR)/buildtools/install.sh -#Solaris: -#INSTALL = /usr/ucb/install -#Tru64: -#INSTALL = installbsd -#OSF1: -#INSTALL = $(SRCDIR)/buildtools/installosf -#Red Hat Linux: -#INSTALL = install - -# STRIPFLAG is the option you pass to the above install program to make it -# strip unnecessary information out of binaries. -STRIPFLAG = -s -# If you don't want to strip the binaries, just leave it null: -#STRIPFLAG = - -SYMLINK = ln -s -# At least some Windows environments don't have any concept of symbolic -# links, but direct copies are usually a passable alternative. -#SYMLINK = cp - -#MANPAGE_FORMAT is "nroff" or "cat". It determines in what format the -#pointer man pages are installed (ready to nroff, or ready to cat). -#A pointer man pages is just a single-paragraph pages that tells you there is -#no man page for the program, to look at the HTML documentation instead. -MANPAGE_FORMAT = nroff -#MANPAGE_FORMAT = cat - -AR = ar -RANLIB = ranlib -# IRIX, SCO don't have Ranlib: -#RANLIB = true - -# LEX is the beginning of a shell command that runs a Lex-like -# pattern matcher generator. Null string means there isn't any such -# command. That means the build will skip parts that need one. - -LEX = flex -# Solaris: -# LEX = flex -e -# Windows Mingw: -# LEX = -# -# LEX = lex - -# C compiler options - -# gcc: -# -ansi and -Werror should work too, but are not included -# by default because there's no point in daring the build to fail. -# -pedantic isn't a problem because it causes at worst a warning. -#CFLAGS = -O3 -ffast-math -pedantic -fno-common \ -# -Wall -Wno-uninitialized -Wmissing-declarations -Wimplicit \ -# -Wwrite-strings -Wmissing-prototypes -Wundef -# The merged programs have a main_XXX subroutine instead of main(), -# which would cause a warning with -Wmissing-declarations or -# -Wmissing-prototypes. -#CFLAGS_MERGE = -Wno-missing-declarations -Wno-missing-prototypes -# A user of DEC Tru64 4.0F in May 2000 needed -DLONG_32 for ppmtompeg, -# but word size-sensitive code was removed from parallel.c in September 2004. -# A user of Tru64 5.1A in July 2003 needed NOT to have -DLONG_32. In -# theory, you need this if on your system, long is 32 bits and int is not. -# But it may be completely irrelevant today. -#Tru64: -#CFLAGS = -O2 -std1 -DLONG_32 -#CFLAGS = -O2 -std1 -#AIX: -#CFLAGS= -O3 -#HP-UX: -#CFLAGS= -O3 -fPIC -#IRIX: -#CFLAGS= -n32 -O3 -#Amiga with GNU compiler: -#CFLAGS= -m68020-60 -ffast-math -mstackextend -# You can add -noixemul for Amiga and successfully compile most of the -# programs. (Of the remaining ones, if you can supply your own strtod() -# function, most of them will build with -noixemul). So try building -# with 'make --keep-going CADD=-noixemul' first, then just 'make' to build -# everything that failed for lack of the ixemul library in the first step. -# That way, the parts that don't required the ixemul library won't indicate -# a dependency on it. -#OpenBSD: -#CFLAGS = -I/usr/local/include - -# EXE is a suffix that the linker puts on any executable it generates. -# In cygwin, this is .exe and most programs deal with its existence without -# us having to know about it. Some don't though, so set this: - -EXE = -#Cygwin, DJGPP/Windows: -#EXE = .exe - -# linker options. - -# LDFLAGS is often set as an environment variable; A setting here overrides -# it. So either make sure you want to override it, or do a "LDFLAGS +=" here. - -# LDFLAGS is usually not the right place for a -L option, because we put -# LDFLAGS _before_ our own -L options, so it would cancel out our -# specific selection of libraries. For example, if you say -# LDFLAGS=/usr/local/lib and an old copy of the libnetpbm is in -# /usr/local/lib, then you'd be linking against that old copy instead of -# the copy you just built, which is located by a -L option later on the -# link command. LIBS is the right variable for adding -L options. LIBS -# goes after any of our make files' own -L options. - -# Eunice users may want to use -noshare so that the executables can -# run standalone: -#LDFLAGS += -noshare -#Tru64: -# Russ Allberry says on 2001.06.09 that -oldstyle_liblookup may be necessary -# to keep from finding an ancient system libjpeg.so that isn't compatible with -# NetPBM. Michael Long found that /usr/local/lib is not in the default -# search path, or not soon enough, and he was getting an old libjpeg that -# caused all the jpeg symbol references to be unresolved. He had installed -# a new libjpeg in /usr/local/lib. -#LDFLAGS += -call_shared -oldstyle_liblookup -L/usr/local/lib -#AIX: -#LDFLAGS += -L /usr/pubsw/lib -#HP-UX: -#LDFLAGS += -Wl,+b,/usr/pubsw/lib -#IRIX: -#LDFLAGS += -n32 - -# Linker options for created Netpbm shared libraries. - -# 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) -# 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. -# BeOS doesn't have sonames built in. -#LDSHLIB = -nostart -#LDSHLIB = -G -# Solaris, SunOS with GNU Ld, SCO: -# These systems have no soname option. -#LDSHLIB = -shared -# Solaris with Sun Ld: -#LDSHLIB = -Wl,-Bdynamic,-G,-h,$(SONAME) -#Tru64: -#LDSHLIB = -shared -expect_unresolved "*" -#IRIX: -#LDSHLIB = -shared -n32 -#AIX GNU compiler/linker: -#LDSHLIB = -shared -#AIX Visual Age C: -#LDSHLIB = -qmkshrobj -#Mac OSX: -# According to experiments done by Peter A Crowley in May 2007, if -# libnetpbm goes in a standard place such as /usr/local/lib, -# programs need not be built with libnetpbm's location included. -# But if it goes elsewhere, the link-editor must include the -# location in the executable. It finds the runtime location by -# looking inside the library. The information in the library -# comes from the install_name option with which the library was -# built. It's an alternative to the -rpath option on other systems. -#LDSHLIB=-dynamiclib -#LDSHLIB=-dynamiclib -install_name $(NETPBMLIB_RUNTIME_PATH)/libnetpbm.$(MAJ).dylib - -# LDRELOC is the command to combine two .o files (relocateable object files) -# into a single .o file that can later be linked into something else. NONE -# means no such command is available. - -LDRELOC = NONE -# GNU Ld: -# Older GNU Ld misspells the option as --relocateable. Newer GNU Ld -# correctly spells it --relocatable. The abbreviation --reloc works on -# both. -#LDRELOC = ld --reloc -#LDRELOC = ld -r - - -# On older systems, you have to make shared libraries out of position -# independent code, so you need -fpic or fPIC here. (The rule is: if -# -fpic works, use it. If it bombs, go to fPIC). On newer systems, -# it isn't necessary, but can save real memory at the expense of -# execution speed. Without position independent code, the library -# loader may have to patch addresses into the executable text. On an -# older system, this would cause a program crash because the loader -# would be writing into read-only shared memory. But on newer -# systems, the system silently creates a private mapping of the page -# or segment being modified (the "copy on write" phenomenon). So it -# needs its own private real page frame. In one experiment, A second -# copy of Pbmtext used 16K less real memory when built with -fpic than -# when built without. 2001.06.02. - -# We have seen -fPIC required on IA64 and AMD64 machines (GNU -# compiler/linker). Build-time linking fails without it. I don't -# know why -- history seems to be repeating itself. 2005.02.23. - -CFLAGS_SHLIB = -# Gcc: -#CFLAGS_SHLIB = -fpic -#CFLAGS_SHLIB = -fPIC -# Sun compiler: -#CFLAGS_SHLIB = -Kpic -#CFLAGS_SHLIB = -KPIC - -# SHLIB_CLIB is the link option to include the C library in a shared library, -# normally "-lc". On typical systems, this serves no purpose. On some, -# though, it causes information about which C library to use to be recorded -# in the shared library and thus choose the correct library among several or -# avoid using an incompatible one. But on some systems, the link fails. -# On 2002.09.30, "John H. DuBois III" <spcecdt@armory.com> reports that on -# SCO OpenServer, he gets the following error message with -lc: -# -# -lc; relocations referenced ; from file(s) /usr/ccs/lib/libc.so(random.o); -# fatal error: relocations remain against allocatable but non-writable -# section: ; .text - -SHLIB_CLIB = -lc -# SCO: -#SHLIB_CLIB = - -# On some systems you have to build into an executable the list of -# directories where its dynamically linked libraries can be found at -# run time. This is typically done with a -R or -rpath linker -# option. Even on systems that don't require it, you might prefer to do -# that rather than set up environment variables or configuration files -# to tell the system where the libraries are. A "Y" here means to put -# the directory information in the executable at link time. - -NEED_RUNTIME_PATH = N -# Solaris, SunOS, NetBSD, AIX: -#NEED_RUNTIME_PATH = Y - -# RPATHOPTNAME is the option you use on the link command to specify -# a runtime search path for a shared library. It is meaningless unless -# NEED_RUNTIME_PATH is Y. -RPATHOPTNAME = -rpath - -# The following variables tell where your various libraries on which -# Netpbm depends live. The LIBxxx variable is a full file -# specification of the link library (not necessarily the library used -# at run time). e.g. "/usr/local/lib/graphics/libjpeg.so". It usually -# doesn't matter if the library prefix and suffix are right -- you can -# use "lib" and ".so" or ".a" regardless of what your system actually -# uses because these just turn into "-L" and "-l" linker options -# anyway. ".a" implies a static library for some purposes, though. -# If you don't have the library in question, use a value of NONE for -# LIBxxx and the build will simply skip the programs that require that -# library. If the library is in your linker's (or the Netpbm build's) -# default search path, leave off the directory part, e.g. "libjpeg.so". - -# The xxxHDR_DIR variable is the directory in which the interface -# headers for the library live (e.g. /usr/include). If they are in your -# compiler's default search path, set this variable to null. - -# This is where the Netpbm shared libraries will reside when Netpbm is -# fully installed. In some configurations, the Netpbm builder builds -# this information into the Netpbm executables. This does NOT affect -# where the Netpbm installer installs the libraries. A null value -# means the libraries are in a default search path used by the runtime -# library loader. -NETPBMLIB_RUNTIME_PATH = -#NETPBMLIB_RUNTIME_PATH = /usr/lib/netpbm - -# The TIFF library. See above. If you want to build the tiff -# converters, you must have the tiff library already installed. - -TIFFLIB = NONE -TIFFHDR_DIR = - -#TIFFLIB = libtiff.so -#TIFFHDR_DIR = /usr/include/libtiff -#NetBSD: -#TIFFLIB = $(LOCALBASE)/lib/libtiff.so -#TIFFHDR_DIR = $(LOCALBASE)/include -# OSF, Tru64: -#TIFFLIB = /usr/local1/DEC/lib/libtiff.so -#TIFFHDR_DIR = /usr/local1/DEC/include - -# Some TIFF libraries do Jpeg and/or Z (flate) compression and thus any -# program linked with the TIFF library needs a Jpeg and/or Z library. -# Some TIFF libraries have such library statically linked in, but others -# need it to be dynamically linked at program load time. -# Make this 'N' if youf TIFF library doesn't need such dynamic linking. -# As of 2005.01, the most usual build of the TIFF library appears to require -# both. -TIFFLIB_NEEDS_JPEG = Y -TIFFLIB_NEEDS_Z = Y - -# The JPEG library. See above. If you want to build the jpeg -# converters you must have the jpeg library already installed. - -# Tiff files can use JPEG compression, so the Tiff library can reference -# the JPEG library. If your Tiff library references a dynamic JPEG -# library, you must specify at least JPEGLIB here, or the Tiff -# converters will not build. Note that your Tiff library may have the -# JPEG stuff statically linked in, in which case you won't need -# JPEGLIB in order to build the Tiff converters. - -JPEGLIB = NONE -JPEGHDR_DIR = -#JPEGLIB = libjpeg.so -#JPEGHDR_DIR = /usr/include/jpeg -# Netbsd: -#JPEGLIB = ${LOCALBASE}/lib/libjpeg.so -#JPEGHDR_DIR = ${LOCALBASE}/include -# OSF, Tru64: -#JPEGLIB = /usr/local1/DEC/libjpeg.so -#JPEGHDR_DIR = /usr/local1/DEC/include -# Typical: -#JPEGLIB = /usr/local/lib/libjpeg.so -#JPEGHDR_DIR = /usr/local/include -# Don't build JPEG stuff: -#JPEGLIB = NONE - - -# The PNG library. See above. If you want to build the PNG -# converters you must have the PNG library already installed. - -# The PNG library, by convention starting around April 2002, gets installed -# with names that include a version number, such as libpng10.a and header -# files in /usr/include/libpng10. But there is conventionally an unnumbered -# alias (e.g. libpng.a, /usr/include/libpng) for the preferred version. -# -# Recent versions of the library (since some time in the 2002-2006 period) -# have an associated 'libpng-config' that tells how to link it. The make -# files will use that program if it exists (must be in the PATH). In that -# case, PNGLIB and PNGHDR_DIR are irrelevant, but PNGVER is still meaningful, -# because the make file runs 'libpng$(PNGVER)-config'. - -PNGLIB = NONE -PNGHDR_DIR = -PNGVER = -#PNGLIB = libpng$(PNGVER).so -#PNGHDR_DIR = /usr/include/libpng$(PNGVER) -# NetBSD: -#PNGLIB = $(LOCALBASE)/lib/libpng$(PNGVER).so -#PNGHDR_DIR = $(LOCALBASE)/include -# OSF/Tru64: -#PNGLIB = /usr/local1/DEC/lib/libpng$(PNGVER).so -#PNGHDR_DIR = /usr/local1/DEC/include - -# The zlib compression library. See above. You need it to build -# anything that needs the PNG library (see above). If you selected -# NONE for the PNG library, it doesn't matter what you specify here -- -# it won't get used. -# -# If you have 'libpng-config' (see above), these are irrelevant. - -ZLIB = NONE -ZHDR_DIR = -#ZLIB = libz.so - -# The JBIG lossless image compression library (aka JBIG-KIT): - -JBIGLIB = $(BUILDDIR)/converter/other/jbig/libjbig.a -JBIGHDR_DIR = $(SRCDIR)/converter/other/jbig - -# The Jasper JPEG-2000 image compression library (aka JasPer): -JASPERLIB = $(INTERNAL_JASPERLIB) -JASPERHDR_DIR = $(INTERNAL_JASPERHDR_DIR) -# JASPERDEPLIBS is the libraries (-l options or file names) on which -# The Jasper library depends -- i.e. what you have to link into any -# executable that links in the Jasper library. -JASPERDEPLIBS = -#JASPERDEPLIBS = -ljpeg - -# And the Utah Raster Toolkit (aka URT aka RLE) library: - -URTLIB = $(BUILDDIR)/urt/librle.a -URTHDR_DIR = $(SRCDIR)/urt - -# The X11 library has facilities for talking to an X Window System -# server. It is required by Pamx. - -X11LIB = NONE -X11HDR_DIR = - -#X11LIB = /usr/lib/libX11.so -#X11HDR_DIR = - -# The Linux SVGA library (Svgalib) is a facility for displaying graphics -# on the Linux console. It is required by Ppmsvgalib. - -LINUXSVGALIB = NONE -LINUXSVGAHDR_DIR = - -#LINUXSVGALIB = /usr/lib/libvga.so -#LINUXSVGAHDR_DIR = /usr/include/vgalib - -# If you don't want any network functions, set OMIT_NETWORK to "y". -# The only thing that requires network functions is the option in -# ppmtompeg to run it on multiple computers simultaneously. On some -# systems network functions don't work or we haven't figured out how to -# make them work, or they just aren't worth the effort. -OMIT_NETWORK = -#DJGPP/Windows, Tru64: -# (there's some minor header problem that prevents network functions from -# building on Tru64 2000.10.06) -#OMIT_NETWORK = y - -# These are -l options to link in the network libraries. Often, these are -# built into the standard C library, so this can be null. This is irrelevant -# if OMIT_NETWORK is "y". - -NETWORKLD = -# Solaris, SunOS: -#NETWORKLD = -lsocket -lnsl -# SCO: -#NETWORKLD = -lsocket, -lresolv - -VMS = -#VMS: -#VMS = yes - -# DONT_HAVE_PROCESS_MGMT is Y if this system doesn't have the usual -# Unix process management stuff - fork, wait, etc. N for a regular Unix -# system. -DONT_HAVE_PROCESS_MGMT = N - -# The following variables are used only by 'make install' (and the -# variants of it). Paths here don't, for example, get built into any -# programs. - -# This is where everything goes when you do 'make package', unless you -# override it by setting 'pkgdir' on the Make command line. -PKGDIR_DEFAULT = /tmp/netpbm - -# Subdirectory of the package directory ($(pkgdir)) in which man pages -# go. -PKGMANDIR = man - -# File permissions for installed files. -# Note that on some systems (e.g. Solaris), 'install' can't use the -# mnemonic permissions - you have to use octal. - -# binaries (pbmmake, etc) -INSTALL_PERM_BIN = 755 # u=rwx,go=rx -# shared libraries (libpbm.so, etc) -INSTALL_PERM_LIBD = 755 # u=rwx,go=rx -# static libraries (libpbm.a, etc) -INSTALL_PERM_LIBS = 644 # u=rw,go=r -# header files (pbm.h, etc) -INSTALL_PERM_HDR = 644 # u=rw,go=r -# man pages (pbmmake.1, etc) -INSTALL_PERM_MAN = 644 # u=rw,go=r -# data files (pnmtopalm color maps, etc) -INSTALL_PERM_DATA = 644 # u=rw,go=r - -# Specify the suffix that want the man pages to have. - -SUFFIXMANUALS1 = 1 -SUFFIXMANUALS3 = 3 -SUFFIXMANUALS5 = 5 - -#NETPBMLIBTYPE tells the kind of libraries that will get built to hold the -#Netpbm library functions. The value is used only in make file tests. -# "unixshared" means a unix-style shared library, typically named like -# libxyz.so.2.3 -NETPBMLIBTYPE = unixshared -# "unixstatic" means a unix-style static library, (like libxyz.a) -#NETPBMLIBTYPE = unixstatic -# "dll" means a Windows DLL shared library -#NETPBMLIBTYPE = dll -# "dylib" means a Darwin/Mac OS shared library -#NETPBMLIBTYPE = dylib - -#NETPBMLIBSUFFIX is the suffix used on whatever kind of library is -#selected above. All this is used for is to construct library names. -#The make files never examine the actual value. -NETPBMLIBSUFFIX = so - -# "a" is the suffix for unix-style static libraries. It is also -# traditionally used for shared libraries on AIX. The Visual Age C -# manual says sometimes .so works on AIX, and GNU software for AIX -# 5.1.0 does indeed use it. In our experiments, it works fine if you -# name the library file explicitly on the link, but isn't in the -l -# search order. If you name the library explicitly on the link, the -# library must live in exactly the same position at run time, so we -# can't use that. Therefore, you cannot build both static and shared -# libraries with AIX. You have to choose. -#NETPBMLIBSUFFIX = a -# For HP-UX shared libraries: -#NETPBMLIBSUFFIX = sl -# Darwin/Mac OS shared library: -#NETPBMLIBSUFFIX = dylib -# Windows shared library: -#NETPBMLIBSUFFIX = dll - -#STATICLIB_TOO is "y" to signify that you want a static library built -#and installed in addition to whatever library type you specified by -#NETPBMLIBTYPE. If NETPBMLIBTYPE specified a static library, -#STATICLIB_TOO simply has no effect. -STATICLIB_TOO = y -#STATICLIB_TOO = n - -#STATICLIBSUFFIX is the suffix that static libraries have. It's -#meaningless if you aren't building static libraries. -STATICLIBSUFFIX = a - -#SHLIBPREFIXLIST is a blank-delimited list of prefixes that a filename -#of a shared library may have on this system. Traditionally, it's -#just "lib", as in libc or libnetpbm. On Windows, though, varying -#prefixes are used when multiple alternative forms of a library are -#available. The first prefix in this list is what we use to name the -#Netpbm shared libraries. -# -# This variable controls how 'libopt' gets built. -# -SHLIBPREFIXLIST = lib -#Cygwin: -#SHLIBPREFIXLIST = cyg lib - -NETPBMSHLIBPREFIX = $(firstword $(SHLIBPREFIXLIST)) - -#DLLVER is used to version the DLLs built on cygwin or other -#windowsish platforms. We can't add this to LIBROOT, or we'd -#version the static libs (which is bad). We can't add this -#at the end of the name (like unix does with so numbers) because -#windows will only load dlls whose name ends in "dll". So, -#we have this variable, which becomes the end of the library "root" name -#for DLLs only. -# -# This variable controls how 'libopt' gets built. -# -DLLVER = -#Cygwin -#DLLVER = $(NETPBM_MAJOR_RELEASE) - -#NETPBM_DOCURL is the URL of the main documentation page for Netpbm. -#This is a directory which contains a file for each Netpbm program, -#library, and file type. E.g. The documentation for jpegtopnm might be in -#http://netpbm.sourceforge.net/doc/jpegtopnm.html . This value gets -#installed in the man pages (which say no more than to read the webpage) -#and in the Webman netpbm.url file. -NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/ -#For a system with no web access, but a local copy of the doc: -#NETPBM_DOCURL = file:/usr/doc/netpbm/ - - - - - -####Lines above were copied from config.mk.in by 'configure'. -####Lines below were added by 'configure' based on the GNU platform. -DEFAULT_TARGET = nonmerge -NETPBMLIBTYPE=unixshared -NETPBMLIBSUFFIX=so -STATICLIB_TOO=n -CFLAGS = -O3 -ffast-math -pedantic -fno-common -Wall -Wno-uninitialized -Wmissing-declarations -Wimplicit -Wwrite-strings -Wmissing-prototypes -Wundef -CFLAGS_MERGE = -Wno-missing-declarations -Wno-missing-prototypes -LDRELOC = ld --reloc -LINKER_CAN_DO_EXPLICIT_LIBRARY=Y -LINKERISCOMPILER = Y -CFLAGS_SHLIB += -fPIC -TIFFLIB = libtiff.so -JPEGLIB = libjpeg.so -ZLIB = libz.so -X11LIB = libX11.so -NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/ diff --git a/source/l/netpbm/netpbm-CAN-2005-2471.patch b/source/l/netpbm/netpbm-CAN-2005-2471.patch new file mode 100644 index 000000000..24495de17 --- /dev/null +++ b/source/l/netpbm/netpbm-CAN-2005-2471.patch @@ -0,0 +1,17 @@ +diff -urNp a/converter/other/pstopnm.c b/converter/other/pstopnm.c +--- a/converter/other/pstopnm.c 2018-07-23 15:14:51.200658026 +0200 ++++ b/converter/other/pstopnm.c 2018-07-23 15:18:12.579910612 +0200 +@@ -896,11 +896,11 @@ execGhostscript(int const + ghostscriptProg, arg0, + deviceopt, outfileopt, gopt, ropt, textalphabitsopt, + "-q", "-dNOPAUSE", +- "-dSAFER", "-"); ++ "-dPARANOIDSAFER", "-"); + } + + execl(ghostscriptProg, arg0, deviceopt, outfileopt, gopt, ropt, "-q", +- "-dNOPAUSE", "-dSAFER", "-", NULL); ++ "-dNOPAUSE", "-dPARANOIDSAFER", "-", NULL); + + pm_error("execl() of Ghostscript ('%s') failed, errno=%d (%s)", + ghostscriptProg, errno, strerror(errno)); diff --git a/source/l/netpbm/netpbm-CVE-2017-2587.patch b/source/l/netpbm/netpbm-CVE-2017-2587.patch new file mode 100644 index 000000000..7e3bad7bb --- /dev/null +++ b/source/l/netpbm/netpbm-CVE-2017-2587.patch @@ -0,0 +1,26 @@ +diff -urNp old/converter/other/svgtopam.c new/converter/other/svgtopam.c +--- old/converter/other/svgtopam.c 2017-02-08 12:11:02.593690917 +0100 ++++ new/converter/other/svgtopam.c 2017-02-08 13:49:38.319029371 +0100 +@@ -771,12 +771,17 @@ createCanvas(unsigned int const width, + + MALLOCVAR_NOFAIL(canvasP); + +- canvasP->width = width; +- canvasP->height = height; +- canvasP->pixels = ppm_allocarray(width, height); +- canvasP->maxval = maxval; ++ if(canvasP != NULL){ ++ canvasP->width = width; ++ canvasP->height = height; ++ canvasP->pixels = ppm_allocarray(width, height); ++ canvasP->maxval = maxval; ++ ++ *canvasPP = canvasP; ++ } else { ++ pm_error("can't allocate memory for canvas"); ++ } + +- *canvasPP = canvasP; + } + + diff --git a/source/l/netpbm/netpbm-bmptopnm.patch b/source/l/netpbm/netpbm-bmptopnm.patch new file mode 100644 index 000000000..90954274b --- /dev/null +++ b/source/l/netpbm/netpbm-bmptopnm.patch @@ -0,0 +1,11 @@ +--- netpbm-10.35/converter/other/bmptopnm.c.bmptopnm 2007-01-29 13:08:46.000000000 +0100 ++++ netpbm-10.35/converter/other/bmptopnm.c 2007-01-29 13:32:21.000000000 +0100 +@@ -1262,7 +1262,7 @@ readBmp(FILE * const ifP, + xel ** const colormapP, + bool const verbose) { + +- xel * colormap; /* malloc'ed */ ++ xel * colormap = NULL; /* malloc'ed */ + unsigned int pos; + /* Current byte position in the BMP file */ + diff --git a/source/l/netpbm/netpbm-cmuwtopbm.patch b/source/l/netpbm/netpbm-cmuwtopbm.patch new file mode 100644 index 000000000..f5b328be8 --- /dev/null +++ b/source/l/netpbm/netpbm-cmuwtopbm.patch @@ -0,0 +1,21 @@ +diff -up netpbm-10.61.01/converter/pbm/cmuwmtopbm.c.cmuwtopbmfix netpbm-10.61.01/converter/pbm/cmuwmtopbm.c +--- netpbm-10.61.01/converter/pbm/cmuwmtopbm.c.cmuwtopbmfix 2013-01-02 18:39:57.000000000 +0100 ++++ netpbm-10.61.01/converter/pbm/cmuwmtopbm.c 2013-01-03 05:41:36.024984241 +0100 +@@ -18,7 +18,7 @@ + This program does not check the pad bits at the end of each row. + */ + +- ++#include <stdint.h> + #include "pbm.h" + + /*-------------------------- +@@ -42,7 +42,7 @@ readCmuwmHeader(FILE * const ifP + "CMU window manager header EOF / read error"; + uint32_t const cmuwmMagic = 0xf10040bb; + +- long l; ++ uint32_t l; + short s; + int rc; + diff --git a/source/l/netpbm/netpbm-docfix.patch b/source/l/netpbm/netpbm-docfix.patch new file mode 100644 index 000000000..33b3b77dc --- /dev/null +++ b/source/l/netpbm/netpbm-docfix.patch @@ -0,0 +1,124 @@ +diff -urNp old/userguide/cameratopam.html new/userguide/cameratopam.html +--- old/userguide/cameratopam.html 2017-09-05 09:05:16.000000000 +0200 ++++ new/userguide/cameratopam.html 2017-09-05 13:16:33.622352535 +0200 +@@ -25,10 +25,10 @@ cameratopam - convert raw camera image t + [<b>-balance_camera</b>] + [<b>-red_scale=</b><i>float</i>] + [<b>-blue_scale=</b><i>float</i>] +-[<b>-brightness=</b><i>fraction</i>] ++[<b>-bright=</b><i>fraction</i>] + [<b>-no_clip_color</b>] + [<b>-rgb</b>] +-[<b>-secondary</b>] ++[<b>-use_secondary</b>] + [<b>-linear</b>] + [<b>-verbose</b>] + +@@ -106,7 +106,7 @@ the default. + <dd>Further adjust the color balance by multiplying the red and blue + channels by these values. Both default to 1.0. + +-<dt><b>-brightness=</b><i>float</i> ++<dt><b>-bright=</b><i>float</i> + + <dd>Change the output brightness. Default is 1.0. + +@@ -114,14 +114,14 @@ channels by these values. Both default + + <dd>By default, <b>cameratoapm</b> clips all colors to prevent pink + hues in the highlights. Combine this option with +-<b>-brightness=0.25</b> to leave the image data completely unclipped. ++<b>-bright=0.25</b> to leave the image data completely unclipped. + + <dt><b>-rgb</b> + + <dd>Write raw camera colors to the output file. By default, + <b>cameratoapm</b> converts to sRGB colorspace. + +-<dt><b>-secondary</b> ++<dt><b>-use_secondary</b> + + <dd>For cameras based on the Fuji Super CCD SR, this option causes + <b>cameratopam</b> to use the secondary sensors, in effect +diff -urNp old/userguide/fiascotopnm.html new/userguide/fiascotopnm.html +--- old/userguide/fiascotopnm.html 2017-09-05 09:05:16.000000000 +0200 ++++ new/userguide/fiascotopnm.html 2017-09-05 13:32:51.810458154 +0200 +@@ -51,7 +51,7 @@ the output file(s) are written to the fi + this list. Otherwise, the current directory is used to store the + output file(s). + +-<DT><B>-z</B>, <B>--fast</B> ++<DT><B>-r</B>, <B>--fast</B> + <DD> + Decompress images in the 4:2:0 format; i.e., each chroma channel is + decompressed to an image of halved width and height. Use this option +@@ -83,7 +83,7 @@ given amount <I>N</I>. <I>N</I> is 1 (mi + is 70. When <I>N</I>=0, then the smoothing amount specified in the + FIASCO file is used (defined by the FIASCO coder). + +-<DT><B>-F</B> <I>N</I>, <B>--fps=</B><I>N</I> ++<DT><B>-F</B> <I>N</I>, <B>--framerate=</B><I>N</I> + <DD> + Set number of frames per second to <I>N</I>. When using this option, + the frame rate specified in the FIASCO file is overridden. +@@ -113,13 +113,8 @@ following methods (in the specified orde + <LI>--config=<I>name</I> + </OL> + +-<DT><B>-h</B>, <B>--info</B> +-<DD> +-Print brief help, then exit. +- +-<DT><B>-H</B>, <B>--help</B> +-<DD> +-Print detailed help, then exit. ++<DT><B>-h</B>, <B>--help</B> ++Print help, then exit. + + </DL> + +diff -urNp old/userguide/pamperspective.html new/userguide/pamperspective.html +--- old/userguide/pamperspective.html 2017-09-05 09:05:16.000000000 +0200 ++++ new/userguide/pamperspective.html 2017-09-05 13:23:15.869997105 +0200 +@@ -220,7 +220,7 @@ default rectangle as the "frame." The vi + a rectangle the axes of which are parallel to those of the frame. + + <p>The frame options are additive. All the parts of the image +-specified by either margin options, <b>--include_frame</b>, or ++specified by either margin options, <b>--frame_include</b>, or + <b>--include</b> (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 -urNp old/converter/pbm/pbmtoepson.c new/converter/pbm/pbmtoepson.c +--- old/converter/pbm/pbmtoepson.c 2018-01-04 14:26:14.740024843 +0100 ++++ new/converter/pbm/pbmtoepson.c 2018-01-04 14:28:47.970518766 +0100 +@@ -75,7 +75,7 @@ parseCommandLine(int ar + &dpiSpec, 0); + OPTENT3(0, "adjacent", OPT_FLAG, NULL, + &adjacentSpec, 0); +- OPTENT3(0, "nonadjacent", OPT_FLAG, NULL, ++ OPTENT3(0, "noadjacent", OPT_FLAG, NULL, + &nonadjacentSpec, 0); + + opt.opt_table = option_def; +diff -urNp old/userguide/pbmtoepson.html new/userguide/pbmtoepson.html +--- old/userguide/pbmtoepson.html 2018-01-04 14:26:14.586024719 +0100 ++++ new/userguide/pbmtoepson.html 2018-01-04 14:27:56.466847698 +0100 +@@ -18,7 +18,7 @@ pbmtoepson - convert a PBM image into Ep + [<b>-dpi=</b><i>n</i>] + [<b>-protocol=</b>{<b>escp9</b>|<B>escp</B>}] + [<b>-adjacent</b>] +-[<b>-nonadjacent</b>] ++[<b>-noadjacent</b>] + + [<I>pbmfile</I>] + +@@ -74,7 +74,7 @@ print density for you consistent with yo + <p>This option was new in Netpbm 10.23 (July 2004). + + <dt><b>-adjacent</b> +-<dt><b>-nonadjacent</b> ++<dt><b>-noadjacent</b> + + <dd>These options determine whether the output uses "adjacent dot + printing" or not, whatever that is. diff --git a/source/l/netpbm/netpbm-fiasco-overflow.patch b/source/l/netpbm/netpbm-fiasco-overflow.patch new file mode 100644 index 000000000..850dbc308 --- /dev/null +++ b/source/l/netpbm/netpbm-fiasco-overflow.patch @@ -0,0 +1,12 @@ +diff -up netpbm-10.47.09/converter/other/fiasco/lib/image.h.fiasco-overflow netpbm-10.47.09/converter/other/fiasco/lib/image.h +--- netpbm-10.47.09/converter/other/fiasco/lib/image.h.fiasco-overflow 2010-01-25 09:00:48.000000000 +0100 ++++ netpbm-10.47.09/converter/other/fiasco/lib/image.h 2010-01-27 10:29:48.000000000 +0100 +@@ -29,7 +29,7 @@ typedef struct image + * Image data + */ + { +- char id [7]; ++ char id [8]; + unsigned reference_count; + unsigned width; /* Width of the image */ + unsigned height; /* Height of the image */ diff --git a/source/l/netpbm/netpbm-gcc4.patch b/source/l/netpbm/netpbm-gcc4.patch new file mode 100644 index 000000000..3f518262d --- /dev/null +++ b/source/l/netpbm/netpbm-gcc4.patch @@ -0,0 +1,22 @@ +diff -up netpbm-10.58.01/lib/pm.h.gcc4 netpbm-10.58.01/lib/pm.h +--- netpbm-10.58.01/lib/pm.h.gcc4 2012-04-09 19:08:08.885137097 +0200 ++++ netpbm-10.58.01/lib/pm.h 2012-04-09 19:08:08.894136984 +0200 +@@ -18,6 +18,7 @@ + #include <sys/types.h> + #include <ctype.h> + #include <stdio.h> ++#include <string.h> + #include <errno.h> + #include <setjmp.h> + #include <sys/stat.h> +diff -up netpbm-10.58.01/urt/rle.h.gcc4 netpbm-10.58.01/urt/rle.h +--- netpbm-10.58.01/urt/rle.h.gcc4 2012-04-09 19:08:08.000000000 +0200 ++++ netpbm-10.58.01/urt/rle.h 2012-04-09 19:08:39.137758887 +0200 +@@ -34,6 +34,7 @@ + #define RLE_H + + #include <stdio.h> /* Declare FILE. */ ++#include <string.h> + + enum rle_dispatch { + NO_DISPATCH = -1, diff --git a/source/l/netpbm/netpbm-glibc.patch b/source/l/netpbm/netpbm-glibc.patch new file mode 100644 index 000000000..4ae71e8da --- /dev/null +++ b/source/l/netpbm/netpbm-glibc.patch @@ -0,0 +1,13 @@ +--- netpbm-10.35/converter/other/pnmtotiffcmyk.c.glibc 2006-09-18 12:20:06.000000000 +0200 ++++ netpbm-10.35/converter/other/pnmtotiffcmyk.c 2007-08-23 09:18:30.000000000 +0200 +@@ -974,8 +974,8 @@ int main( int argc, char **argv ) { + + if ( (err = parseOpts( argc, argv, rt )) ) goto exit ; + +- if ( (err = rt->in->open( rt->in, rt )) ) goto exit ; +- if ( (err = rt->out->open( rt->out, rt )) ) goto exit ; ++ if ( (err = (rt->in->open)( rt->in, rt )) ) goto exit ; ++ if ( (err = (rt->out->open)( rt->out, rt )) ) goto exit ; + + while ( rt->in->hasMore( rt->in ) ) { + if ( (err = rt->in->next( rt->in, &r, &g, &b )) ) goto exit ; diff --git a/source/l/netpbm/netpbm-manfix.patch b/source/l/netpbm/netpbm-manfix.patch new file mode 100644 index 000000000..54df85f53 --- /dev/null +++ b/source/l/netpbm/netpbm-manfix.patch @@ -0,0 +1,184 @@ +diff -urNp old/userguide/avstopam.html new/userguide/avstopam.html +--- old/userguide/avstopam.html 2017-09-05 13:58:08.338559550 +0200 ++++ new/userguide/avstopam.html 2017-09-05 14:00:27.371039472 +0200 +@@ -1,8 +1,7 @@ + <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> ++<html> + <head> + <title>Avstopam User Manual</title> +-<meta http-equiv="content-type" content="text/html; charset=us-ascii" /> + </head> + + <body> +diff -urNp old/userguide/escp2topbm.html new/userguide/escp2topbm.html +--- old/userguide/escp2topbm.html 2017-09-05 13:58:08.335559561 +0200 ++++ new/userguide/escp2topbm.html 2017-09-05 14:01:20.226842694 +0200 +@@ -6,6 +6,7 @@ Updated: 14 July 2015 + <BR> + <A HREF="#index">Table Of Contents</A> + ++<H2>NAME</H2> + escp2topbm - convert an ESC/P2 printer file to a PBM image + + <H2 id="synopsis">SYNOPSIS</H2> +diff -urNp old/userguide/faxformat.html new/userguide/faxformat.html +--- old/userguide/faxformat.html 2017-09-05 13:58:08.337559553 +0200 ++++ new/userguide/faxformat.html 2017-09-05 14:02:33.322571279 +0200 +@@ -5,10 +5,11 @@ + Updated: 03 December 2008 + <BR> + ++<H2>SYNOPSIS</H2> + <p>This page, part of the <a href="index.html">Netpbm user's guide</a>, + describes FAX formats in relation to Netpbm facilities. + +- ++<H2>DESCRIPTION</H2> + <p>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 -urNp old/userguide/pampaintspill.html new/userguide/pampaintspill.html +--- old/userguide/pampaintspill.html 2017-09-05 13:58:08.338559550 +0200 ++++ new/userguide/pampaintspill.html 2017-09-05 14:03:32.625351620 +0200 +@@ -1,8 +1,7 @@ + <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +-<html xmlns="http://www.w3.org/1999/xhtml"> ++<html> + <head> + <title>Pampaintspill User Manual</title> +-<meta http-equiv="content-type" content="text/html; charset=us-ascii" /> + </head> + + <body> +@@ -11,6 +10,7 @@ + + <p><a href="#index">Table Of Contents</a></p> + ++<H2>NAME</H2> + <p>pampaintspill - smoothly spill colors into the background</p> + + <h2><a name="synopsis">SYNOPSIS</a></h2> +diff -urNp old/userguide/pamrecolor.html new/userguide/pamrecolor.html +--- old/userguide/pamrecolor.html 2017-09-05 13:58:08.336559557 +0200 ++++ new/userguide/pamrecolor.html 2017-09-05 14:04:34.714122098 +0200 +@@ -1,8 +1,7 @@ +-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> ++<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> + <html> + <head> + <title>Pamrecolor User Manual</title> +-<meta http-equiv="Content-type" content="text/html;charset=UTF-8"> + </head> + + <body> +@@ -11,7 +10,7 @@ + + <p>Updated: 31 July 2010</p> + +-<p><a href="#contents">Table Of Contents</a></p> ++<p><a href="#index">Table Of Contents</a></p> + + + <h2 id="name">NAME</h2> +diff -urNp old/userguide/pamsistoaglyph.html new/userguide/pamsistoaglyph.html +--- old/userguide/pamsistoaglyph.html 2017-09-05 13:58:08.334559565 +0200 ++++ new/userguide/pamsistoaglyph.html 2017-09-05 14:05:25.865944327 +0200 +@@ -1,8 +1,7 @@ + <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +-<html xmlns="http://www.w3.org/1999/xhtml"> ++<html> + <head> + <title>Pamsistoaglyph User Manual</title> +-<meta http-equiv="content-type" content="text/html; charset=us-ascii" /> + </head> + + <body> +diff -urNp old/userguide/pamstereogram.html new/userguide/pamstereogram.html +--- old/userguide/pamstereogram.html 2017-09-05 13:58:08.337559553 +0200 ++++ new/userguide/pamstereogram.html 2017-09-05 14:13:28.523959069 +0200 +@@ -1,5 +1,5 @@ +-<!DOCTYPE html> +-<html xmlns="http://www.w3.org/1999/xhtml"> ++<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> ++<html> + <head> + <title>Pamstereogram User Manual</title> + </head> +@@ -10,7 +10,7 @@ + + <p>Updated: 19 June 2015</p> + +-<p><a href="#contents">Table Of Contents</a></p> ++<p><a href="#index">Table Of Contents</a></p> + + + <h2 id="name">NAME</h2> +diff -urNp old/userguide/pamtoavs.html new/userguide/pamtoavs.html +--- old/userguide/pamtoavs.html 2017-09-05 13:58:08.329559583 +0200 ++++ new/userguide/pamtoavs.html 2017-09-05 14:05:49.299863901 +0200 +@@ -1,5 +1,5 @@ + <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> ++<html> + <head> + <title>Pamtoavs User Manual</title> + <meta http-equiv="content-type" content="text/html; charset=us-ascii" /> +diff -urNp old/userguide/pamtooctaveimg.html new/userguide/pamtooctaveimg.html +--- old/userguide/pamtooctaveimg.html 2017-09-05 13:58:08.335559561 +0200 ++++ new/userguide/pamtooctaveimg.html 2017-09-05 14:06:21.825752356 +0200 +@@ -1,8 +1,7 @@ + <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> ++<html> + <head> + <title>Pamtooctaveimg User Manual</title> +-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + </head> + + <body> +diff -urNp old/userguide/pnmflip.html new/userguide/pnmflip.html +--- old/userguide/pnmflip.html 2017-09-05 13:58:08.336559557 +0200 ++++ new/userguide/pnmflip.html 2017-09-05 14:07:15.065963977 +0200 +@@ -4,9 +4,11 @@ + <BODY> + <H1>pnmflip</H1> + <BR> ++<H2>NAME</H2> + <p><b>pnmflip</b> was replaced in Netpbm 10.13 (December 2002) by + <b><a href="pamflip.html">pamflip</a></b>. + ++<H2>DESCRIPTION</H2> + <P><B>pamflip</b> is mostly backward compatible with <b>pnmflip</b>, + but works on PAM images too. + +diff -urNp old/userguide/pnmmercator.html new/userguide/pnmmercator.html +--- old/userguide/pnmmercator.html 2017-09-05 13:58:08.334559565 +0200 ++++ new/userguide/pnmmercator.html 2017-09-05 14:08:08.305214742 +0200 +@@ -1,7 +1,6 @@ +-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> ++<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> + <html> + <head> +-<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> + <title>PnmMercator User Manual</title> + </head> + <body> +diff -urNp old/userguide/ppmtogif.html new/userguide/ppmtogif.html +--- old/userguide/ppmtogif.html 2017-09-05 13:58:08.337559553 +0200 ++++ new/userguide/ppmtogif.html 2017-09-05 14:09:51.450583126 +0200 +@@ -4,11 +4,14 @@ + <BODY> + <H1>ppmtogif</H1> + <BR> ++<H2>NAME</H2> + <p><b>ppmtogif</b> was replaced in Netpbm 10.37 (December 2006) by + <b><a href="pamtogif.html">pamtogif</a></b>. + ++<H2>SYNOPSIS</H2> + <P><B>pamtogif</b> is mostly backward compatible with <b>ppmtogif</b>. + ++<H2>DESCRIPTION</H2> + <P>One way <b>pamtogif</b> is not backward compatible with <b>ppmtogif</b> + is that to specify a transparency (alpha) mask with <b>ppmtogif</b>, you + supply the transparency as a separate pseudo-PGM image and use the diff --git a/source/l/netpbm/netpbm-manual-pages.patch b/source/l/netpbm/netpbm-manual-pages.patch new file mode 100644 index 000000000..b5fbbeae6 --- /dev/null +++ b/source/l/netpbm/netpbm-manual-pages.patch @@ -0,0 +1,1343 @@ +diff -urNp old/userguide/libnetpbm_ug.html new/userguide/libnetpbm_ug.html +--- old/userguide/libnetpbm_ug.html 2017-09-05 14:20:09.734743404 +0200 ++++ new/userguide/libnetpbm_ug.html 2017-09-05 14:47:30.496705483 +0200 +@@ -374,7 +374,7 @@ plain format. + <H2 id="reference">Reference</h2> + + <p>The <a href="libnetpbm_image.html">Libnetpbm Netpbm Image +-Processing Manual</a> describes the the <b>libnetpbm</b> functions for ++Processing Manual</a> describes the <b>libnetpbm</b> functions for + processing image data. + + <p>The <a href="libpm.html">Libnetpbm Utility Manual</a> +diff -urNp old/userguide/pamfunc.html new/userguide/pamfunc.html +--- old/userguide/pamfunc.html 2017-09-05 14:20:09.738743398 +0200 ++++ new/userguide/pamfunc.html 2017-09-05 14:47:41.760644848 +0200 +@@ -57,7 +57,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. + + <h4>Arithmetic functions</h4> +diff -urNp old/userguide/pbmtextps.html new/userguide/pbmtextps.html +--- old/userguide/pbmtextps.html 2017-09-05 14:20:09.736743401 +0200 ++++ new/userguide/pbmtextps.html 2017-09-05 14:47:58.840553598 +0200 +@@ -185,7 +185,7 @@ edge of the type. See <a href="#margins + <dt><b>-ascent=</b><i>n</i> + <dt><b>-descent=</b><i>n</i> + <dd> +-These options control the the margins added to the image, measured from ++These options control the margins added to the image, measured from + the text baseline. See <a href="#margins">Margins</a> for details. + + <p>Sizes are in points, as a floating point number. +diff -urNp old/userguide/pbmtog3.html new/userguide/pbmtog3.html +--- old/userguide/pbmtog3.html 2017-09-05 14:20:09.735743403 +0200 ++++ new/userguide/pbmtog3.html 2017-09-05 14:48:55.648255793 +0200 +@@ -77,7 +77,7 @@ You cannot specify both. + <H2 id="history">HISTORY</H2> + + <p>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 + <<A HREF="mailto:paul@manray.sgi.com">paul@manray.sgi.com</A>> in 1989 + and then modified extensively by others. + +diff -urNp old/userguide/ppmtompeg.html new/userguide/ppmtompeg.html +--- old/userguide/ppmtompeg.html 2017-09-05 14:20:09.739743396 +0200 ++++ new/userguide/ppmtompeg.html 1970-01-01 01:00:00.000000000 +0100 +@@ -1,1291 +0,0 @@ +-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"> +-<HTML> +-<HEAD> +-<TITLE>Ppmtompeg User Manual</TITLE> +-</HEAD> +-<BODY> +-<H1>Ppmtompeg</H1> +-Updated: 23 July 2006 +-<BR> +-<A HREF="#index">Table Of Contents</A> +- +-<H2>NAME</H2> +-ppmtompeg - encode an MPEG-1 bitstream +- +-<H2 id="synopsis">SYNOPSIS</H2> +- +-<B>ppmtompeg</B> +-[<I>options</I>] +-<I>parameter-file</I> +- +-<H2 id="description">DESCRIPTION</H2> +- +-<p>This program is part of <a href="index.html">Netpbm</a>. +- +-<P><B>ppmtompeg</B> produces an MPEG-1 video stream. MPEG-1 is the +-first great video compression method, and is what is used in Video CDs +-(VCD). <b>ppmtompeg</b> originated in the year 1995. DVD uses a more +-advanced method, MPEG-2. There is an even newer method called MPEG-4 +-which is also called Divx. I don't know where one finds that used. +- +-<p>There's technically a difference between a compression method for +-video and an actual file (stream) format for a movie, and I don't know +-if it can be validly said that the format of the stream +-<b>ppmtompeg</b> produces is MPEG-1. +- +-<p>Mencoder from the <a href="http://www.mplayerhq.hu">Mplayer +-package</a> is probably superior for most video format generation +-needs, if for no other reason than that it is more popular. +- +-<p>The programming library <a href="http://pm2v.free.fr"><b>PM2V</b></a> +-generates MPEG-2 streams. +- +-<p>Use <a href="http://www.mplayerhq.hu">Mplayer</a> (not part of Netpbm) +-to do the reverse conversion: to create a series of PNM files from an MPEG +-stream. +- +-<p><i>param_file</i> is a parameter file which includes a list of +-input files and other parameters. The file is described in detail +-below. +- +-<P>To understand this program, you need to understand something about +-the complex MPEG-1 format. One source of information about this +-standard format is the section Introduction to MPEG in the <a +-href="http://www.faqs.org/faqs/compression-faq">Compression FAQ</a>. +- +-<H2 id="options">OPTIONS</H2> +- +-<p>The <b>-gop</b>, <b>-combine_gops</b>, <b>-frames</b>, and +-<b>-combine_frames</b> options are all mutually exclusive. +- +-<DL COMPACT> +-<DT><B>-stat stat_file</B> +- +-<DD>This option causes <b>ppmtompeg</b> to append the statistics that +-it write to Standard Output to the file <I>stat_file</I> as well. The +-statistics use the following abbreviations: bits per block (bpb), bits +-per frame (bpf), seconds per frame (spf), and bits per second (bps). +- +-<p>These statistics include how many I, P, and B frames there were, +-and information about compression and quality. +- +- +-<DT><B>-quiet</b> <i>num_seconds</i> +- +-<DD> causes <b>ppmtompeg</b> not to report remaining time more often +-than every <i>num_seconds</i> seconds (unless the time estimate rises, +-which will happen near the beginning of the run). A negative value +-tells <b>ppmtompeg</b> not to report at all. 0 is the default +-(reports once after each frame). Note that the time remaining is an +-estimate and does not take into account time to read in frames. +- +-<DT><B>-realquiet</B> <DD> causes <b>ppmtompeg</b> to run silently, +-with the only screen output being errors. Particularly useful when +-reading input from stdin. +- +-<DT> +-<B>-no_frame_summary</B> +- +-<DD> This option prevents <b>ppmtompeg</b> from printing a summary +-line for each frame +- +-<DT><B>-float_dct</B> +- +-<DD> forces <b>ppmtompeg</b> to use a more accurate, yet more +-computationally expensive version of the DCT. +- +-<DT><B>-gop</b> <i>gop_num</i> +-<DD> +-causes <b>ppmtompeg</b> to encode only the numbered GOP (first GOP is 0). The +-parameter file is the same as for normal usage. The output file will be +-the normal output file with the suffix <b>.gop.</b><i>gop_num</i>. +-<b>ppmtompeg</b> does not output any sequence information. +- +-<DT><B>-combine_gops</B> +- +-<DD> causes <b>ppmtompeg</b> simply to combine some GOP files into a +-single MPEG output stream. <b>ppmtompeg</b> inserts a sequence header +-and trailer. In this case, the parameter file needs only to contain +-the SIZE value, an output file, and perhaps a list of input GOP +-files (see below). +- +-If you don't supply a list of input GOP files is used, then +-<b>ppmtompeg</b> assumes you're using the same parameter file you used +-when you created the input (with the <b>-gop</b> option) and +-calculates the corresponding gop filenames itself. If this is not the +-case, you can specify input GOP files in the same manner as normal +-input files -- except instead of using INPUT_DIR, INPUT, and +-END_INPUT, use GOP_INPUT_DIR, GOP_INPUT, and GOP_END_INPUT. If no +-input GOP files are specified, then the default is to use the output +-file name with suffix <b>.gop.</b><i>gop_num</i>, with <i>gop_num</i> +-starting from 0, as the input files. +- +-<p>Thus, unless you're mixing and matching GOP files from different +-sources, you can simply use the same parameter file for creating the +-GOP files (<b>-gop</b>) and for later turning them into an MPEG stream +-(<b>-combine_gops</b>). +- +- +-<DT><B>-frames <i>first_frame</i> <i>last_frame</i></B> +- +-<DD>This option causes <b>ppmtompeg</b> to encode only the frames numbered +-<i>first_frame</i> to <i>last_frame</i>, inclusive. The parameter +-file is the same as for normal usage. The output will be placed in +-separate files, one per frame, with the file names being the normal +-output file name with the suffix <b>.frame.</b><i>frame_num</i>. No +-GOP header information is output. (Thus, the parameter file need not +-include the GOP_SIZE value) +- +-<p>Use <b>ppmtompeg -combine_frames</b> to combine these frames later into +-an MPEG stream. +- +- +-<DT><B>-combine_frames</B> +- +-<DD> This option causes <b>ppmtompeg</b> simply to combine some +-individual MPEG frames (such as you might have created with an earlier +-run of <b>ppmtompeg -frames</b>) into a single MPEG stream. Sequence +-and GOP headers are inserted appropriately. In this case, the +-parameter file needs to contain only the SIZE value, the GOP_SIZE +-value, an output file, and perhaps a list of frame files (see below). +- +-<p>The parameter file may specify input frame files in the same manner +-as normal input files -- except instead of using INPUT_DIR, INPUT, and +-END_INPUT, use FRAME_INPUT_DIR, FRAME_INPUT, and FRAME_END_INPUT. If +-no input frame files are specified, then the default is to use the +-output file name with suffix <b>.frame.</b><i>frame_num</i>, with +-<i>frame_num</i> starting from 0, as the input files. +- +- +- +-<DT><B>-nice</B> +- +-<DD>This option causes <b>ppmtompeg</b> to run any remote processes +-"nicely," i.e. at low priority. (This is relevant only if you are +-running <b>ppmtompeg</b> in parallel mode. Otherwise, there are no +-remote processes). See 'man nice.' +- +-<DT><B>-max_machines <i>num_machines</i></B> +- +-<DD>This option causes <b>ppmtompeg</b> to use no more than +-<i>num_machines</i> machines as slaves for use in parallel encoding. +- +-<DT><B>-snr</B> +- +-<DD>This option causes <b>ppmtompeg</b> to include the signal-to-noise +-ratio in the reported statistics. Prints SNR (Y U V) and peak SNR (Y +-U V) for each frame. In summary, prints averages of luminance only +-(Y). SNR is defined as 10*log(variance of original/variance of +-error). Peak SNR is defined as 20*log(255/RMSE). Note that +-<b>ppmtompeg</b> runs a little slower when you use this option. +- +-<DT><B>-mse</B> +- +-<DD>This option causes <b>ppmtompeg</b> to report the mean squared +-error per block. It also automatically reports the quality of the +-images, so there is no need to specify <b>-snr</b> then. +- +-<DT><B>-bit_rate_info</b> <i>rate_file</i> +- +-<DD> This option makes <b>ppmtompeg</b> write bit rate information +-into the file <i>rate_file</i>. Bit rate information is bits per frame, and +-also bits per I-frame-to-I-frame. +- +-<DT><B>-mv_histogram</B> +- +-<DD> This option causes <b>ppmtompeg</b> to print a histogram of the +-motion vectors as part of statistics. There are three histograms -- +-one for P frame, one for forward B frame, and one for backward B frame +-motion vectors. +- +-<p>The output is in the form of a matrix, each entry corresponding to one +-motion vector in the search window. The center of the matrix +-represents (0,0) motion vectors. +- +-<dt><b>-debug_sockets</b> +- +-<dd>This option causes <b>ppmtompeg</b> to print to Standard Output +-messages that narrate the communication between the machines when you run +-<b>ppmtompeg</b> in <a href="#parallel">parallel mode</a>. +- +-<dt><b>-debug_machines</b> +- +-<dd>This option causes <b>ppmtompeg</b> to print to Standard Output +-messages that narrate the progress of the conversion on the various +-machines when you run <b>ppmtompeg</b> in <a href="#parallel">parallel +-mode</a>. +- +-</DL> +- +-<H2 id="parmfile">PARAMETER FILE</H2> +- +-<P>The parameter file <strong>must</strong> contain the following +-lines (except when using the <b>-combine_gops</b> or <b>-combine_frames</b> +-options): +- +-<DL COMPACT> +- +-<DT><B>PATTERN</b> <i>pattern</i> +- +-<DD>This statement specifies the pattern (sequence) of I frames, P frames, +-and B frames. <i>pattern</i> is just a sequence of the letters I, P, and +-B with nothing between. Example: +- +-<pre> +- PATTERN IBBPBBPBBPBBPBB +-</pre> +- +-<p>See <a href="#ipb">I Frames, P Frames, B Frames</a>. +- +-<DT><B>OUTPUT</b> <i>output file</i> +-<DD>This names the file where the output MPEG stream goes. +- +-<DT><B>INPUT_DIR</b> <i>directory</i> +- +-<DD>This statement tells where the input images (frames) come from. +-If each frame is in a separate file, <i>directory</i> is the directory +-where they all are. You may use <b>.</b> to refer to the current +-directory. A null <i>directory</i> refers to the root directory of the +-system file tree. +- +-<p>To have <b>ppmtompeg</b> read all the frames serially from Standard +-Input, specify +-<pre> +- INPUT_DIR stdin +-</pre> +- +-<DT><B>INPUT</b> +-<DD> +-This line must be followed by a list of the input files (in display order) +-and then the line <B>END_INPUT</B>. +- +-<p>There are three types of lines between INPUT and END_INPUT. First, +-a line may simply be the name of an input file. Second, the line +-may be of the form <i>single_star_expr</i> +-<b>[</b><i>x</i><b>-</b><i>y</i><b>]</b>. +-<i>single_star_expr</i> can have a single <b>*</b> in it. It is +-replaced by all the numbers between x and y inclusive. So, for +-example, the line <b>tennis*.ppm [12-15]</b> refers to the files +-tennis12.ppm, tennis13.ppm, tennis14.ppm, tennis15.ppm. +- +-<p>Uniform zero-padding occurs, as well. For example, the line +-<b>football.*.ppm [001-130]</b> refers to the files football.001.ppm, +-football.002.ppm, ..., football.009.ppm, football.010.ppm, ..., +-football.130.ppm. +- +-<p>The third type of line is: <i>single_star_expr</i> +-<b>[</b><i>x</i><b>-</b><i>y</i><b>+</b><i>s</i><b>]</b>, where the +-line is treated exactly as above, except that we skip by <i>s</i>. Thus, the +-line <b>football.*.ppm [001-130+4]</b> refers to the files +-football.001.ppm, football.005.ppm, football.009.ppm, +-football.013.ppm, etc. +- +-<p>Furthermore, a line may specify a shell command to execute to +-generate lines to be interpreted as described above, as if those lines +-were in the parameter file instead. Use back ticks, like in the +-Bourne Shell, like this: +- +-<pre> +- `cat myfilelist` +-</pre> +- +-<p> +-If input is from Standard Input (per the <b>INPUT_DIR</b> statement), +-<b>ppmtompeg</b> ignores the <B>INPUT</b>/<b>END_INPUT</b> block, but +-it still must be present. +- +-<DT><b>BASE_FILE_FORMAT</b> {<b>PPM</b> | <b>PNM</b> | <b>YUV</b> | +- <b>JPEG</b> | <b>JMOVIE</b>} +- +-<DD><B>ppmtompeg</b> must convert all input files to one of the +-following formats as a first step of processing: PNM, YUV, JPEG(v4), +-or JMOVIE. (The conversion may be trivial if your input files are +-already in one of these formats). This line specifies which of the +-four formats. PPM is actually a subset of PNM. The separate +-specification is allowed for backward compatibility. Use PNM instead +-of PPM in new applications. +- +-<DT><b>INPUT_CONVERT</b> <i>conversion_command</i> +- +-<DD>You must specify how to convert a file to the base file format. +-If no conversion is necessary, then you would just say: +- +- <pre> +- INPUT_CONVERT * +- </pre> +- +-<p>Otherwise, <i>conversion_command</i> is a shell command that causes +-an image in the format your specified with <B>BASE_FILE_FORMAT</b> to +-be written to Standard Output. <b>ppmtompeg</b> executes the command +-once for each line between <b>INPUT</b> and <b>END_INPUT</b> (which is +-normally, but not necessarily, a file name). In the conversion +-command, <b>ppmtompeg</b> replaces each '*' with the contents of that +-line. +- +- If you had a bunch of gif files, you might say: +- <pre> +- INPUT_CONVERT giftopnm * +- </pre> +- +- If you have a bunch of separate a.Y, a.U, and a.V files (where +- the U and V have already been subsampled), then you might say: +- +- <pre> +- INPUT_CONVERT cat *.Y *.U *.V +- </pre> +- +-<p>Input conversion is not allowed with input from stdin, so use +- +- <pre> +- INPUT_CONVERT * +- </pre> +- +-as described above. +- +-<DT><b>SIZE</b> <i>width</i><b>x</b><i>height</i> +- +-<dd> +- +-<p><i>width</i> and <i>height</i> are the width and height of each +-frame in pixels. +- +-<p>When <b>ppmtompeg</b> can get this information from the input image +-files, it ignores the <b>SIZE</b> parameter and you may omit it. +- +-<p>When the image files are in YUV format, the files don't contain +-dimension information, so <b>SIZE</b> is required. +- +-<p>When <b>ppmtompeg</b> is running in parallel mode, not all of the +-processes in the network have access to the image files, so +-<b>SIZE</b> is required and must give the same dimensions as the +-input image files. +- +-<DT><b>YUV_SIZE</b> <i>width</i><b>x</b><i>height</i> +- +-<dd>This is an obsolete synonym of <b>SIZE</b>. +- +-<DT><b>YUV_FORMAT</B> {<b>ABEKAS</b> | <b>PHILLIPS</b> | <b>UCB</B> | +- <b>EYUV</b> | <i>pattern</i>} +- +-<DD>This is meaningful only when <b>BASE_FILE_FORMAT</b> specifies +-YUV format, and then it is required. It specifies the sub-format of +-the YUV class. +- +- +-<DT><b>GOP_SIZE</b> <i>n</i> +- +-<DD><i>n</i> is the number of frames in a Group of Pictures. Except that +-because a GOP must start with an I frame, <b>ppmtompeg</b> makes a GOP as +-much longer than <i>n</i> as it has to to make the next GOP start with an +-I frame. +- +-<p>Normally, it makes sense to make your GOP size a multiple of your +-pattern length (the latter is determined by the PATTERN parameter file +-statement). +- +-<p>See <a href="#gop">Group Of Pictures</a>. +- +-<DT><b>SLICES_PER_FRAME</b> <i>n</i> +-<dd><i>n</i> is roughly the number of slices per frame. Note, at +-least one MPEG player may complain if slices do not start at the left +-side of an image. To ensure this does not happen, make sure the +-number of rows is divisible by SLICES_PER_FRAME. +- +-<DT><b>PIXEL</b> {<b>FULL</b> | <b>HALF</b>} +- +-<dd>use half-pixel motion vectors, or just full-pixel ones It is +-usually important that you use half-pixel motion vectors, because it +-results in both better quality and better compression. +- +- +-<DT><b>RANGE</b> <i>n</i> +-<dd>Use a search range of <i>n</i> pixels in each of the four directions +-from a subject pixel. (So the search window is a square <i>n</i>*2 pixels +-on a side). +- +-<DT><b>PSEARCH_ALG</b> {<b>EXHAUSTIVE</B> | <b>TWOLEVEL</b> | +- <b>SUBSAMPLE</b> | <b>LOGARITHMIC</b>} +- +-<dd>This statement tells <b>ppmtompeg</b> what kind of search +- technique (algorithm) to use for P frames. You select the desired +- combination of speed and compression. <b>EXHAUSTIVE</b> gives the +- best compression, but <b>LOGARITHMIC</B> is the fastest. +- <B>TWOLEVEL</B> is an exhaustive full-pixel search, followed by a +- local half- pixel search around the best full-pixel vector (the +- PIXEL option is ignored for this search technique). +- +-<DT><b>BSEARCH_ALG</b> {<b>SIMPLE</B> | <B>CROSS2</B> | <B>EXHAUSTIVE</B>} +- +-<dd>This statement tells <b>ppmtompeg</b> what kind of search +- technique (algorithm) to use for B frames. <b>SIMPLE</B> means +- find best forward and backward vectors, then interpolate. +- <B>CROSS2</B> means find those two vectors, then see what backward +- vector best matches the best forward vector, and vice versa. +- <b>EXHAUSTIVE</b> does an n-squared search and is +- <em>extremely</em> slow in relation to the others (<b>CROSS2</b> +- is about half as fast as <b>SIMPLE</B>). +- +-<DT><b>IQSCALE</b> <i>n</i> +-<dd>Use <i>n</i> as the qscale for I frames. +- See <a href="#qscale">Qscale</a>. +- +-<DT><b>PQSCALE</b> <i>n</i> +-<dd>Use <i>n</i> as the qscale for P frames. +- See <a href="#qscale">Qscale</a>. +- +-<DT><b>BQSCALE</b> <i>n</i> +-<dd>Use <i>n</i> as the qscale for B frames. +- See <a href="#qscale">Qscale</a>. +- +-<DT><b>REFERENCE_FRAME</b> {<B>ORIGINAL</B> | <b>DECODED</b>} <dd>This +-statement determines whether <b>ppmtompeg</b> uses the original images +-or the decoded images when computing motion vectors. Using decoded +-images is more accurate and should increase the playback quality of +-the output, but it makes the encoding take longer and seems to give +-worse compression. It also causes some complications with parallel +-encoding. (see the section on parallel encoding). One thing you can +-do as a trade-off is select <b>ORIGINAL</b> here, and lower the +-qscale (see <b>QSCALE</b> if the quality is not good enough. +- +-<table border="1" cellpadding="5" cellspacing="0" +-summary="comparison of original to decoded"> +- <caption>Original or Decoded? (Normalized)</caption> +-<?makeman r c c c c c. ?> +-<?makeman _ ?> +- <tr align="center" bgcolor="#CCCCCC"> +- <th>Reference</th> +- <th>Compression</th> +- <th>Speed</th> +- <th>Quality I</th> +- <th>Quality P</th> +- <th>Quality B</th> +- </tr> +- <tr> +- <td align="right">Decoded</td> +- <td align="center">1000</td> +- <td align="center">1000</td> +- <td align="center">1000</td> +- <td align="center">969</td> +- <td align="center">919</td> +- </tr> +- <tr> +- <td align="right">Original</td> +- <td align="center">885</td> +- <td align="center">1373</td> +- <td align="center">1000</td> +- <td align="center">912</td> +- <td align="center">884</td> +- </tr> +- </table> +- +- +- +-</dl> +- +-<p>The following lines are optional: +- +-<DL> +- +-<DT><B>FORCE_ENCODE_LAST_FRAME</B> +- +-<dd>This statement is obsolete. It does nothing. +- +-<p>Before Netpbm 10.26 (January 2005), <b>ppmtompeg</b> would drop +-trailing B frames from your movie, since a movie can't end with a B +-frame. (See <a href="#ipb">I Frames, P Frames, B Frames</a>. +-You would have to specify <b>FORCE_ENCODE_LAST_FRAME</b> to stop +-that from happening and get the same function that <b>ppmtompeg</b> +-has today. +- +- +-<DT><b>NIQTABLE</b> +- +-<dd>This statement specifies a custom non-intra quantization table. +-If you don't specify this statement, <b>ppmtompeg</b> uses a default +-non-intra quantization table. +- +-<p> +-The 8 lines immediately following <b>NIQTABLE</b> specify the quantization +-table. Each line defines a table row and consists of 8 integers, +-whitespace-delimited, which define the table columns. +- +-<DT><B>IQTABLE</b> +- +-<dd>This is analogous to NIQTABLE, but for the intra quantization table. +- +-<DT><b>ASPECT_RATIO</b> <i>ratio</i> +- +-<dd>This statement specifies the aspect ratio for <b>ppmtompeg</b> to +-specify in the MPEG output. I'm not sure what this is used for. +- +-<p><i>ratio</i> must be 1.0, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, +-0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575, or 1.2015. +- +-<DT><b>FRAME_RATE</b> <i>rate</i> +-<dd>This specifies the frame rate for <b>ppmtompeg</b> to specify in the +-MPEG output. Some players use this value to determine the playback rate. +- +-<p><i>rate</i> must be 23.976, 24, 25, 29.97, 30, 50, 59.94, or 60. +- +-<DT><b>BIT_RATE</b> <i>rate</i> +-<DD>This specifies the bit rate for Constant Bit Rate (CBR) encoding. +- +-<p><i>rate</i> must be an integer. +- +-<DT><b>BUFFER_SIZE</b> <i>size</i> +- +-<dd>This specifies the value +-<b>ppmtompeg</b> is to specify in the MPEG output for the Video +-Buffering Verifier (VBV) buffer size needed to decode the sequence. +- +-<p>A Video Verifying Buffer is a buffer in which a decoder keeps the +-decoded bits in order to match the uneven speed of the decoding with +-the required constant playback speed. +- +-<p>As <b>ppmtompeg</b> encodes the image, it simulates the decoding +-process in terms of how many bits would be in the VBV as each frame gets +-decoded, assuming a VBV of the size you indicate. +- +-<P>If you specify the <b>WARN_VBV_UNDERFLOW</b> statement, +-<b>ppmtompeg</b> issues a warning each time the simulation underflows +-the buffer, which suggests that an underflow would occur on playback, +-which suggests the buffer is too small. +- +-<P>If you specify the <b>WARN_VBV_OVERFLOW</b> statement, +-<b>ppmtompeg</b> issues a warning each time the simulation overflows +-the buffer, which suggests that an overflow would occur on playback, +-which suggests the buffer is too small. +- +-<DT><B>WARN_VBV_UNDERFLOW</B> +-<DT><B>WARN_VBV_OVERFLOW</B> +- +-<dd>See <b>BUFFER_SIZE</b>. +- +-<p>These options were new in Netpbm 10.26 (January 2005). Before that, +-<b>ppmtompeg</b> issued the warnings always. +- +-</DL> +- +- +-The following statements apply only to parallel operation: +- +-<DL> +- +-<DT><b>PARALLEL</b> +- +-<dd>This statement, paired with <b>END PARALLEL</B>, is what causes +-<b>ppmtompeg</b> to operate in parallel mode. See <a +-href="#parallel">Parallel Operation</a>. +- +-<dt><b>END PARALLEL</b> +- +-<DD>This goes with <b>PARALLEL</b>. +- +-<DT><b>PARALLEL_TEST_FRAMES</b> <i>n</i> +- +-<dd>The master starts off by measuring each slave's speed. It does +-this by giving each slave <i>n</i> frames to encode and noting how +-long the slave takes to finish. These are not just test frames, +-though -- they're real frames and the results become part of the +-output. +-<b>ppmtompeg</b> is old and measures time in undivided seconds, so +-to get useful timings, specify enough frames that it will take at +-least 5 seconds to process them. The default is 10. +- +-<p>If you specify <b>FORCE_I_ALIGN</b>, <b>ppmtompeg</b> will increase +-the test frames value enough to maintain the alignment. +- +-<p>If there aren't enough frames for every slave to have the indicated +-number of test frames, <b>ppmtompeg</b> will give some slaves fewer. +- +- +-<DT><b>PARALLEL_TIME_CHUNKS</b> <i>t</i> +- +-<dd>When you specify this statement, the master attempts to feed work +-to the slaves in chunks that take <i>t</i> seconds to process. It uses +-the speed measurement it made when it started up (see PARALLEL_TEST_FRAMES) +-to decide how many frames to put in the chunk. This statement obviously +-doesn't affect the first batch of work sent to each slave, which is the +-one used to measure the slave's speed. +- +-<p>Smaller values of <i>t</i> increase communication, but improve load +-balancing. The default is 30 seconds. +- +-<p>You may specify only one of PARALLEL_TIME_CHUNKS, PARALLEL_CHUNK_TAPER, +-and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best. +- +-<DT><b>PARALLEL_CHUNK_TAPER</b> +- +-<DD>When you specify this statement, the master distributes work like +-with PARALLEL_TIME_CHUNKS, except that the master chooses the number +-of seconds for the chunks. It starts with a large number and, as it +-gets closer to finishing the job, reduces it. That way, it reduces +-scheduling overhead when precise scheduling isn't helpful, but still +-prevents a slave from finishing early after all the work has already +-been handed out to the other slaves, and then sitting idle while +-there's still work to do. +- +-<p>You may specify only one of PARALLEL_TIME_CHUNKS, PARALLEL_CHUNK_TAPER, +-and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best. +- +- +-<DT><b>PARALLEL_PERFECT</b> +- +-<dd>If this statement is present, <b>ppmtompeg</b> schedules on the +-assumption that each machine is about the same speed. The master will +-simply divide up the frames evenly between the slaves -- each +-slave gets the same number of frames. If some slaves are faster than +-others, they will finish first and remain idle while the slower slaves +-continue. +- +-<p>This has the advantage of minimal scheduling overhead. Where slaves +-have different speeds, though, it makes inefficient use of the fast +-ones. Where slaves are the same speed, it also has the disadvantage +-that they all finish at the same time and feed their output to the +-single Combine Server in a burst, which makes less efficient use of +-the Combine Server and thus can increase the total elapsed time. +- +-<p>You may specify only one of PARALLEL_TIME_CHUNKS, PARALLEL_CHUNK_TAPER, +-and PARALLEL_PERFECT. PARALLEL_CHUNK_TAPER is usually best. +- +-<DT><b>RSH</b> <i>remote_shell_command</i> +- +-<DD><b>ppmtompeg</b> executes the shell command +-<i>remote_shell_command</i> to start a process on another machine. +-The default command is <b>rsh</b>, and whatever command you specify +-must have compatible semantics. <b>ssh</b> is usually compatible. +-The command <b>ppmtompeg</b> uses is one like this: +-<b>ssh remote.host.com -l username shellcommand</b>. +- +-<p>Be sure to set up <b>.rhosts</b> files or SSH key authorizations +-where needed. Otherwise, you'll have to type in passwords. +- +-<p>On some HP machines, <b>rsh</b> is the restricted shell, and you want +-to specify <b>remsh</b>. +- +-<DT><b>FORCE_I_ALIGN</b> +- +-<dd>This statement forces each slave to encode a chunk of frames which +-is a multiple of the pattern length (see <b>PATTERN</b>). Since the +-first frame in any pattern is an I frame, this forces each chunk +-encoded by a slave to begin with an I frame. +- +-<p>This document used to say there was an argument to +-<b>FORCE_I_ALIGN</b> which was the number of frames <b>ppmtompeg</b> +-would use (and was required to be a multiple of the pattern length). +-But <b>ppmtompeg</b> has apparently always ignored that argument, and +-it does now. +- +-<DT><B>KEEP_TEMP_FILES</B> +- +-<dd>This statement causes <b>ppmtompeg</b> not to delete the temporary +-files it uses to transmit encoded frames to the combine server. This +-means you will be left with a file for each frame, the same as you +-would get with the <b>-frames</b> option. +- +-<p>This is mostly useful for debugging. +- +-<p>This works only if you're using a shared filesystem to communicate +-between the servers. +- +-<p>This option was new in Netpbm 10.26 (January 2005). +- +-</DL> +- +- +-<H3>Parameter File Notes</h3> +- +-<P> If you use the <b>-combine_gops</b> option, then you need to specify +-only the SIZE and OUTPUT values in the parameter file. In +-addition, the parameter file may specify input GOP files in the same +-manner as normal input files -- except instead of using INPUT_DIR, +-INPUT, and END_INPUT, use GOP_INPUT_DIR, GOP_INPUT, and GOP_END_INPUT. +-If you specify no input GOP files, then <b>ppmtompeg</b> uses by default the +-output file name with suffix <b>.gop.</b><i>gop_num</i>, with <i>gop_num</i> +-starting from 0, as the input files. +- +-<p>If you use the <b>-combine_frames</b> option, then you need to +-specify only the SIZE, GOP_SIZE, and OUTPUT values in the +-parameter file. In addition, the parameter file may specify input +-frame files in the same manner as normal input files -- except instead +-of using INPUT_DIR, INPUT, and END_INPUT, use FRAME_INPUT_DIR, +-FRAME_INPUT, and FRAME_END_INPUT. If no input frame files are +-specified, then the default is to use the output file name with suffix +-<b>.frame.</b><i>frame_num</i>, with <i>frame_num</i> starting from 0, +-as the input files. +- +-<p>Any number of spaces and tabs may come between each option and value. Lines +-beginning with <b>#</b> are ignored. Any other lines are ignored except for +-those between INPUT and END_INPUT. This allows you to use the same +-parameter file for normal usage and for <b>-combine_gops</b> and +-<b>-combine_frames</b>. +- +-<P>The file format is case-sensitive so all keywords should be in +-upper case. +- +-<P>The statements may appear in any order, except that the order within +-a block statement (such as INPUT ... END INPUT) is significant. +- +-<P><b>ppmtompeg</b> is prepared to handle up to 16 B frames between +-reference frames when encoding with input from stdin. (To build a +-modified <b>ppmtompeg</b> with a higher limit, change the constant +-B_FRAME_RUN in frame.c and recompile). +- +-<H2 id="general">GENERAL USAGE INFORMATION</H2> +- +-<H3 id="qscale">Qscale</h3> +- +-<p>The quantization scale values (qscale) give a trade-off between +-quality and compression. Using different Qscale values has very little +-effect on speed. The qscale values can be set separately for I, P, and +-B frames. +- +-<p>You select the qscale values with the <B>IQSCALE</b>, +-<b>PQSCALE</b>, and <b>BSCALE</b> parameter file statements. +- +-<p>A qscale value is an integer from 1 to 31. Larger numbers give +-better compression, but worse quality. In the following, the quality +-numbers are peak signal-to-noise ratio, defined as: +-<img src="ppmtompeg-snr.gif" alt="signal-to-noise formula" height="52" width="302"> +-where MSE is the mean squared error. +- +- +-<p>Flower garden tests: +- +-<table border="1" cellpadding="5" cellspacing="0" summary="Qscale vs Quality"> +- <caption>Qscale vs Quality</caption> +-<?makeman r r r r. ?> +-<?makeman _ ?> +- <tr align="center"> +- <th>Qscale</th> +- <th>I Frames</th> +- <th>P Frames</th> +- <th>B Frames</th> +- </tr> +- <tr> +- <td align="right">1</td> +- <td align="right">43.2</td> +- <td align="right">46.3</td> +- <td align="right">46.5</td> +- </tr> +- <tr> +- <td align="right">6</td> +- <td align="right">32.6</td> +- <td align="right">34.6</td> +- <td align="right">34.3</td> +- </tr> +- <tr> +- <td align="right">11</td> +- <td align="right">28.6</td> +- <td align="right">29.5</td> +- <td align="right">30.0</td> +- </tr> +- <tr> +- <td align="right">16</td> +- <td align="right">26.3</td> +- <td align="right">26.8</td> +- <td align="right">28.6</td> +- </tr> +- <tr> +- <td align="right">21</td> +- <td align="right">24.7</td> +- <td align="right">25.0</td> +- <td align="right">27.9</td> +- </tr> +- <tr> +- <td align="right">26</td> +- <td align="right">23.5</td> +- <td align="right">23.9</td> +- <td align="right">27.5</td> +- </tr> +- <tr> +- <td align="right">31</td> +- <td align="right">22.6</td> +- <td align="right">23.0</td> +- <td align="right">27.3</td> +- </tr> +-</table> +- +-<table border="1" cellpadding="5" cellspacing="0" +-summary="Qscale vs Compression"> +- <caption>Qscale vs Compression</caption> +-<?makeman r r r r. ?> +-<?makeman _ ?> +- <tr align="center"> +- <th>Qscale</th> +- <th>I Frames</th> +- <th>P Frames</th> +- <th>B Frames</th> +- </tr> +- <tr> +- <td align="right">1</td> +- <td align="right">2</td> +- <td align="right">2</td> +- <td align="right">2</td> +- </tr> +- <tr> +- <td align="right">6</td> +- <td align="right">7</td> +- <td align="right">10</td> +- <td align="right">15</td> +- </tr> +- <tr> +- <td align="right">11</td> +- <td align="right">11</td> +- <td align="right">18</td> +- <td align="right">43</td> +- </tr> +- <tr> +- <td align="right">16</td> +- <td align="right">15</td> +- <td align="right">29</td> +- <td align="right">97</td> +- </tr> +- <tr> +- <td align="right">21</td> +- <td align="right">19</td> +- <td align="right">41</td> +- <td align="right">173</td> +- </tr> +- <tr> +- <td align="right">26</td> +- <td align="right">24</td> +- <td align="right">56</td> +- <td align="right">256</td> +- </tr> +- <tr> +- <td align="right">31</td> +- <td align="right">28</td> +- <td align="right">73</td> +- <td align="right">330</td> +- </tr> +-</table> +- +- +-<h3>Search Techniques</h3> +- +-<p>There are several different motion vector search techniques +-available. There are different techniques available for P frame +-search and B frame search. Using different search techniques present +-little difference in quality, but a large difference in compression +-and speed. +- +-<p>There are 4 types of P frame search: Exhaustive, TwoLevel, +-SubSample, and Logarithmic. +- +-<p>There are 3 types of B frame search: Exhaustive, Cross2, and +-Simple. +- +-The recommended search techniques are TwoLevel and Logarithmic for +-P frame search, and Cross2 and Simple for B frame search. Here are +-some numbers comparing the different search methods: +- +-<table border="1" cellpadding="5" cellspacing="0" +-summary="P frame motion vector search"> +- <caption>P frame Motion Vector Search (Normalized)</caption> +-<?makeman r c c c. ?> +-<?makeman _ ?> +- <tr align="center"> +- <th>Technique</th> +- <th>Compression<a href="#smallbetter"><sup>1</sup></a></th> +- <th>Speed <a href="#largefaster"><sup>2</sup></a></th> +- <th>Quality <a href="#largebetter"><sup>3</sup></a></th> +- </tr> +- <tr> +- <td align="right">Exhaustive</td> +- <td align="center">1000</td> +- <td align="center">1000</td> +- <td align="center">1000</td> +- </tr> +- <tr> +- <td align="right">SubSample</td> +- <td align="center">1008</td> +- <td align="center">2456</td> +- <td align="center">1000</td> +- </tr> +- <tr> +- <td align="right">TwoLevel</td> +- <td align="center">1009</td> +- <td align="center">3237</td> +- <td align="center">1000</td> +- </tr> +- <tr> +- <td align="right">Logarithmic</td> +- <td align="center">1085</td> +- <td align="center">8229</td> +- <td align="center">998</td> +- </tr> +-</table> +- +-<table border="1" cellpadding="5" cellspacing="0" +-summary="B frame motion vector search"> +- <caption>B frame Motion Vector Search (Normalized)</caption> +-<?makeman r c c c. ?> +-<?makeman _ ?> +- <tr align="center"> +- <th>Technique</th> +- <th>Compression<a href="#smallbetter"><sup>1</sup></a></th> +- <th>Speed<a href="#largefaster"><sup>2</sup></a></th> +- <th>Quality<a href="#largebetter"><sup>3</sup></a></th> +- </tr> +- <tr> +- <td align="right">Exhaustive</td> +- <td align="center">1000</td> +- <td align="center">1000</td> +- <td align="center">1000</td> +- </tr> +- <tr> +- <td align="right">Cross2</td> +- <td align="center">975</td> +- <td align="center">1000</td> +- <td align="center">996</td> +- </tr> +- <tr> +- <td align="right">Simple</td> +- <td align="center">938</td> +- <td align="center">1765</td> +- <td align="center">991</td> +- </tr> +-</table> +- +-<a name="smallbetter"> </a><sup>1</sup>Smaller numbers are better +-compression. +- +-<a name="largefaster"> </a><sup>2</sup>Larger numbers mean faster +-execution. +- +-<a name="largebetter"> </a><sup>3</sup>Larger numbers mean better quality. +- +-<p>For some reason, Simple seems to give better compression, but it +-depends on the image sequence. +- +-<p>Select the search techniques with the <B>PSEARCH_ALG</B> and +-<B>BSEARCH_ALG</b> parameter file statements. +- +- +-<a name="gop"></a> +-<h3>Group Of Pictures (GOP)</h3> +- +-<p>A Group of Pictures (GOP) is a roughly independently decodable +-sequence of frames. An MPEG video stream is made of one or more +-GOP's. You may specify how many frames should be in each GOP with the +-<b>GOP_SIZE</b> parameter file statement. A GOP always starts with an +-I frame. +- +-<p>Instead of encoding an entire sequence, you can encode a single +-GOP. To do this, use the <b>-gop</b> command option. You can later +-join the resulting GOP files at any time by running <b>ppmtompeg</b> +-with the <b>-combine_gops</b> command option. +- +- +-<h3>Slices</h3> +- +-<p>A slice is an independently decodable unit in a frame. It can be +-as small as one macroblock, or it can be as big as the entire frame. +-Barring transmission error, adding slices does not change quality or +-speed; the only effect is slightly worse compression. More slices are +-used for noisy transmission so that errors are more recoverable. Since +-usually errors are not such a problem, we usually just use one slice +-per frame. +- +-<p>Control the slice size with the <B>SLICES_PER_FRAME</B> parameter +-file statement. +- +-<p>Some MPEG playback systems require that each slice consist of whole +-rows of macroblocks. If you are encoding for this kind of player, if +-the height of the image is H pixels, then you should set the +-SLICES_PER_FRAME to some number which divides H/16. For example, if +-the image is 240 pixels (15 macroblocks) high, then you should use +-only 15, 5, 3, or 1 slices per frame. +- +-<p>Note: these MPEG playback systems are really wrong, since the MPEG +-standard says this doesn't have to be so. +- +- +- +-<h3>Search Window</h3> +- +-<p>The search window is the window in which <b>ppmtompeg</b> searches +-for motion vectors. The window is a square. You can specify the size +-of the square, and whether to allow half-pixel motion vectors or not, +-with the <b>RANGE</b> and <b>PIXEL</B> parameter file statements. +- +-<h3 id="ipb">I Frames, P Frames, B Frames</h3> +- +-<p>In MPEG-1, a movie is represented as a sequence of MPEG frames, +-each of which is an I Frame, a P Frame, or a B Frame. Each represents +-an actual frame of the movie (don't get confused by the dual use of +-the word "frame." A movie frame is a graphical image. An MPEG frame +-is a set of data that describes a movie frame). +- +-<p>An I frame ("intra" frame) describes a movie frame in isolation -- +-without respect to any other frame in the movie. A P frame +-("predictive" frame) describes a movie frame by describing how it +-differs from the movie frame described by the latest preceding I or +-P frame. A B frame ("bidirectional" frame) describes a movie frame by +-describing how it differs from the movie frames described by the +-nearest I or P frame before <em>and</em> after it. +- +-<p>Note that the first frame of a movie must be described by an I +-frame (because there is no previous movie frame) and the last movie +-frame must be described by an I or P frame (because there is no +-subsequent movie frame). +- +-<p>Beyond that, you can choose which frames are represented by which +-types. You specify a pattern, such as IBPBP and <b>ppmtompeg</b> +-simply repeats it over and over throughout the movie. The pattern +-affects speed, quality, and stream size. Here is a chart which shows +-some of the trade-offs: +- +-<table border="1" cellpadding="5" cellspacing="0" +-summary="Comparison of I/P/B Frames"> +- <caption>Comparison of I/P/B Frames (Normalized)</caption> +-<?makeman r c c c. ?> +-<?makeman _ ?> +- <tr align="center"> +- <th>Frame Type</th> +- <th>Size</th> +- <th>Speed</th> +- <th>Quality</th> +- </tr> +- <tr> +- <td align="right">I frames</td> +- <td align="center">1000</td> +- <td align="center">1000</td> +- <td align="center">1000</td> +- </tr> +- <tr> +- <td align="right">P frames</td> +- <td align="center">409</td> +- <td align="center">609</td> +- <td align="center">969</td> +- </tr> +- <tr> +- <td align="right">B frames</td> +- <td align="center">72</td> +- <td align="center">260</td> +- <td align="center">919</td> +- </tr> +- </table> +- +-(this is with constant qscale) +- +-<p>A standard sequence is IBBPBBPBBPBBPBB. +- +-<p>Select the sequence with the <B>PATTERN</B> parameter file statement. +- +-<p>Since the last MPEG frame cannot be a B frame (see above), if the +-pattern you specify indicates a B frame for the last movie frame of +-the movie, <b>ppmtompeg</b> makes it an I frame instead. +- +-<p>Before Netpbm 10.26 (January 2005), <b>ppmtompeg</b> instead drops +-the trailing B frames by default, and you need the +-<b>FORCE_ENCODE_LAST_FRAME</b> parameter file statement to make it do +-this. +- +-<p>The MPEG frames don't appear in the MPEG-1 stream in the same order that +-the corresponding movie frames appear in the movie -- the B frames come after +-the I and P frames on which they are based. For example, if the movie is +-4 frames that you will represent with the pattern IBBP, the MPEG-1 stream +-will start with an I frame describing movie frame 0. The next frame in +-the MPEG-1 stream is a P frame describing movie frame 3. The last two +-frames in the MPEG-1 stream are B frames describing movie frames 1 and 2, +-respectively. +- +- +-<h3>Specifying Input and Output Files</h3> +- +-<p>Specify the input frame images with the <B>INPUT_DIR</B>, +-<B>INPUT</B>, <B>END_INPUT</B>, <B>BASE_FILE_FORMAT</B>, +-<B>SIZE</B>, <B>YUV_FORMAT</B> and <b>INPUT_CONVERT</B> parameter +-file statements. +- +-<p>Specify the output file with the <b>OUTPUT</b> parameter file statement. +- +- +-<h3>Statistics</h3> +- +-<p><b>ppmtompeg</b> can generate a variety of statistics about the +-encoding. See the <b>-stat</b>, <b>-snr</b>, <b>-mv_histogram</b>, +-<b>-quiet</b>, <b>-no_frame_summary</b>, and <b>-bit_rate_info</b> +-options. +- +- +-<H2 id="parallel">PARALLEL OPERATION</H2> +- +-<P>You can run <b>ppmtompeg</b> on multiple machines at once, encoding +-the same MPEG stream. When you do, the machines are used as shown in +-the following diagram. We call this "parallel mode." +- +-<p><img src="ppmtompeg-par.gif" alt="ppmtompeg-par.gif"> +- +-<p>To do parallel processing, put the statement +- +-<pre> +- PARALLEL +-</pre> +- +-in the parameter file, followed by a listing of the machines, one +-machine per line, then +- +-<pre> +- END_PARALLEL +-</pre> +- +-Each of the machine lines must be in one of two forms. If the machine +-has filesystem access to the input files, then the line is: +- +-<p> +-<i>machine</i> <i>user</i> <i>executable</i> +- +-<P>The executable is normally <b>ppmtompeg</b> (you may need to give +-the complete path if you've built for different architectures). If +-the machine does not have filesystem access to the input files, the line +-is: +- +-<P><b>REMOTE</b> <i>machine</i> <i>user</i> <i>executable</i> +-<i>parameter file</i> +- +-<p>The <b>-max_machines</b> command option limits the number of +-machines <b>ppmtompeg</b> will use. If you specify more machines in +-the parameter file than <b>-max_machines</b> allows, <b>ppmtompeg</b> +-uses only the machines listed first. This is handy if you want to +-experiment with different amounts of parallelism. +- +-<p>In general, you should use full path file names when describing +-executables and parameter files. This <em>includes</em> the parameter +-file argument on the original invocation of <b>ppmtompeg</b>. +- +-<p>All file names must be the same on all systems (so if e.g. you're +-using an NFS filesystem, you must make sure it is mounted at the same +-mountpoint on all systems). +- +-<P>Because not all of the processes involved in parallel operation +-have easy access to the input files, you must specify the <B>SIZE</B> +-parameter file statement when you do parallel operation. +- +-<p>The machine on which you originally invoke <b>ppmtompeg</b> is the +-master machine. It hosts a "combine server,", a +-"decode server," and a number of "i/o servers," +-all as separate processes. The other machines in the network (listed +-in the parameter file) are slave machines. Each hosts a single +-process that continuously requests work from the master and does it. +-The slave process does the computation to encode MPEG frames. It +-processes frames in batches identified by the master. +- +-<p>The master uses a remote shell command to start a process on a +-slave machine. By default, it uses an <b>rsh</b> shell command to do +-this. But use the <b>RSH</b> parameter file statement to control +-this. The shell command the master executes remotely is +-<b>ppmtompeg</b>, but with options to indicate that it is to perform +-slave functions. +- +-<p>The various machines talk to each other over TCP connections. Each +-machine finds and binds to a free TCP port number and tells its +-partners the port number. These port numbers are at least 2048. +- +-<p>Use the PARALLEL_TEST_FRAMES, PARALLEL_TIME_CHUNKS, and +-PARALLEL_PERFECT parameter file statements to control the way the +-master divides up work among the slaves. +- +-<p>Use the <b>-nice</b> command option to cause all slave processes to run +-"nicely," i.e. as low priority processes. That way, this substantial and +-long-running CPU load will have minimal impact on other, possibly +-interactive, users of the systems. +- +-<A NAME="speed"> </A> +-<H2>SPEED</h2> +- +-<p>Here is a look at <b>ppmtompeg</b> speed, in single-node (not parallel) +-operation: +- +-<table border="1" cellpadding="5" cellspacing="0" summary="Compression speed"> +- <caption>Compression Speed</caption> +-<?makeman r c. ?> +-<?makeman _ ?> +- <tr align="center"> +- <th>Machine Type</th> +- <th>Macroblocks per second<sup>1</sup></th> +- </tr> +- <tr> +- <td align="right">HP 9000/755</td> +- <td align="center">280</td> +- </tr> +- <tr> +- <td align="right">DEC 3000/400</td> +- <td align="center">247</td> +- </tr> +- <tr> +- <td align="right">HP 9000/750</td> +- <td align="center">191</td> +- </tr> +- <tr> +- <td align="right">Sparc 10</td> +- <td align="center">104</td> +- </tr> +- <tr> +- <td align="right">DEC 5000</td> +- <td align="center">68</td> +- </tr> +-</table> +-<sup>1</sup>A macroblock is a 16x16 pixel square +- +-<p>The measurements in the table are with inputs and outputs via a +-conventional locally attached filesystem. If you are using a network +-filesystem over a single 10 MB/s Ethernet, that constrains your speed more +-than your CPU speed. In that case, don't expect to get better than 4 +-or 5 frames per second no matter how fast your CPUs are. +- +-<p>Network speed is even more of a bottleneck when the slaves do not +-have filesystem access to the input files -- i.e. you declare them +-REMOTE. +- +-<p>Where I/O is the bottleneck, size of the input frames can make a big +-difference. So YUV input is better than PPM, and JPEG is better than +-both. +- +-<p>When you're first trying to get parallel mode working, be sure to +-use the <b>-debug_machines</b> option so you can see what's going on. +-Also, <b>-debug_sockets</b> can help you diagnose communication +-problems. +- +- +-<H2 id="authors">AUTHORS</H2> +- +-<UL> +- +-<LI>Kevin Gong - University of California, Berkeley, <A +-HREF="mailto:keving@cs.berkeley.edu">keving@cs.berkeley.edu</A> +- +-<LI>Ketan Patel - University of California, Berkeley, <A +-HREF="mailto:kpatel@cs.berkeley.edu">kpatel@cs.berkeley.edu</A> +- +-<LI>Dan Wallach - University of California, Berkeley, <A +-HREF="mailto:dwallach@cs.berkeley.edu">dwallach@cs.berkeley.edu</A> +- +-<LI>Darryl Brown - University of California, Berkeley, <A +-HREF="mailto:darryl@cs.berkeley.edu">darryl@cs.berkeley.edu</A> +- +-<LI>Eugene Hung - University of California, Berkeley, <A +-HREF="mailto:eyhung@cs.berkeley.edu">eyhung@cs.berkeley.edu</A> +- +-<LI>Steve Smoot - University of California, Berkeley, <A +-HREF="mailto:smoot@cs.berkeley.edu">smoot@cs.berkeley.edu</A> +- +-</UL> +- +-<HR> +-<A NAME="index"> </A> +-<H2>Table Of Contents</H2> +-<UL> +-<LI><A HREF="#synopsis">SYNOPSIS</A></LI> +-<LI><A HREF="#description">DESCRIPTION</A></LI> +-<LI><A HREF="#options">OPTIONS</A></LI> +-<LI><A HREF="#parmfile">PARAMETER FILE</A></LI> +-<LI><A HREF="#general">GENERAL USAGE INFORMATION</A></LI> +-<LI><A HREF="#parallel">PARALLEL OPERATION</A></LI> +-<LI><A HREF="#speed">SPEED</A></LI> +-<LI><A HREF="#authors">AUTHORS</A></LI> +-</UL> +-</BODY> +-</HTML> diff --git a/source/l/netpbm/netpbm-multilib.patch b/source/l/netpbm/netpbm-multilib.patch new file mode 100644 index 000000000..ea689bca1 --- /dev/null +++ b/source/l/netpbm/netpbm-multilib.patch @@ -0,0 +1,11 @@ +diff -up netpbm-10.47.04/buildtools/endiangen.c.multilib netpbm-10.47.04/buildtools/endiangen.c +--- netpbm-10.47.04/buildtools/endiangen.c.multilib 2009-10-21 13:38:54.000000000 +0200 ++++ netpbm-10.47.04/buildtools/endiangen.c 2009-10-21 14:35:58.000000000 +0200 +@@ -87,7 +87,6 @@ main(int argc, char **argv) { + byteOrder() == ENDIAN_LITTLE ? "LITTLE_ENDIAN" : "BIG_ENDIAN"); + printf("#endif\n"); + printf("\n"); +- printf("#define BITS_PER_LONG %u\n", bitsPerLong()); + + return 0; + } diff --git a/source/l/netpbm/netpbm-noppmtompeg.patch b/source/l/netpbm/netpbm-noppmtompeg.patch index 58b7fa8ef..f5fbd57b3 100644 --- a/source/l/netpbm/netpbm-noppmtompeg.patch +++ b/source/l/netpbm/netpbm-noppmtompeg.patch @@ -1,17 +1,7 @@ -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 +diff --git a/converter/ppm/Makefile b/converter/ppm/Makefile +index b97349d..f68170f 100644 +--- a/converter/ppm/Makefile ++++ b/converter/ppm/Makefile @@ -7,7 +7,7 @@ VPATH=.:$(SRCDIR)/$(SUBDIR) include $(BUILDDIR)/config.mk diff --git a/source/l/netpbm/netpbm-pamtojpeg2k.patch b/source/l/netpbm/netpbm-pamtojpeg2k.patch new file mode 100644 index 000000000..9615ce736 --- /dev/null +++ b/source/l/netpbm/netpbm-pamtojpeg2k.patch @@ -0,0 +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) + + pm_close(ifP); + +- pm_close(stdout); +- + return 0; + } diff --git a/source/l/netpbm/netpbm-pnmtops.patch b/source/l/netpbm/netpbm-pnmtops.patch deleted file mode 100644 index 31bce9e29..000000000 --- a/source/l/netpbm/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/source/l/netpbm/netpbm-ppmfadeusage.patch b/source/l/netpbm/netpbm-ppmfadeusage.patch new file mode 100644 index 000000000..d48f5f546 --- /dev/null +++ b/source/l/netpbm/netpbm-ppmfadeusage.patch @@ -0,0 +1,57 @@ +diff -urNp old/editor/ppmfade new/editor/ppmfade +--- old/editor/ppmfade 2017-11-01 11:47:49.869611402 +0100 ++++ new/editor/ppmfade 2017-11-01 11:53:25.524973342 +0100 +@@ -84,7 +84,7 @@ for ($n = 0; $n < @ARGV; $n++) { + if (-e $first_file) { + } else { + print "I can't find first file '$first_file'\n"; +- exit 20; ++ exit 1; + } + } elsif ($ARGV[$n] eq "-l") { + $n++; +@@ -92,7 +92,7 @@ for ($n = 0; $n < @ARGV; $n++) { + if (-e $last_file) { + } else { + print "I can't find last file '$last_file'\n"; +- exit 20; ++ exit 1; + } + } elsif ($ARGV[$n] eq "-base") { + $n++; +@@ -113,9 +113,12 @@ for ($n = 0; $n < @ARGV; $n++) { + $mode = $BLOCK; + } elsif ("$ARGV[$n]" eq "-mix") { + $mode = $MIX; ++ } 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; + } + } + # +@@ -134,18 +137,18 @@ if ($first_file ne "undefined") { + $width = $1; $height = $2; + } else { + print("Unrecognized results from pnmfile on $first_file.\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); ++ exit 1; + } + + print("Frames are " . $width . "W x " . $height . "H\n"); diff --git a/source/l/netpbm/netpbm-python3.patch b/source/l/netpbm/netpbm-python3.patch new file mode 100644 index 000000000..f611b81af --- /dev/null +++ b/source/l/netpbm/netpbm-python3.patch @@ -0,0 +1,9 @@ +diff -urNp old/buildtools/makeman new/buildtools/makeman +--- old/buildtools/makeman 2018-01-03 12:15:55.000000000 +0100 ++++ new/buildtools/makeman 2018-02-26 14:18:39.993760106 +0100 +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # + # makeman -- compile netpbm's stereotyped HTML to troff markup + # diff --git a/source/l/netpbm/netpbm-security-code.patch b/source/l/netpbm/netpbm-security-code.patch new file mode 100644 index 000000000..6cb6394cb --- /dev/null +++ b/source/l/netpbm/netpbm-security-code.patch @@ -0,0 +1,1601 @@ +diff -urNp a/analyzer/pgmtexture.c b/analyzer/pgmtexture.c +--- a/analyzer/pgmtexture.c 2018-07-23 15:03:21.372486801 +0200 ++++ b/analyzer/pgmtexture.c 2018-07-23 15:05:03.047265799 +0200 +@@ -98,6 +98,8 @@ vector(unsigned int const nl, + + assert(nh >= nl); + ++ overflow_add(nh - nl, 1); ++ + MALLOCARRAY(v, (unsigned) (nh - nl + 1)); + + if (v == NULL) +@@ -129,6 +131,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."); +@@ -137,6 +140,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 -urNp a/converter/other/gemtopnm.c b/converter/other/gemtopnm.c +--- a/converter/other/gemtopnm.c 2018-07-23 15:03:21.379486786 +0200 ++++ b/converter/other/gemtopnm.c 2018-07-23 15:05:03.053265786 +0200 +@@ -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 -urNp a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c +--- a/converter/other/jpegtopnm.c 2018-07-23 15:03:21.398486744 +0200 ++++ b/converter/other/jpegtopnm.c 2018-07-23 15:05:03.068265754 +0200 +@@ -862,6 +862,8 @@ convertImage(FILE * + /* 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 -urNp a/converter/other/pbmtopgm.c b/converter/other/pbmtopgm.c +--- a/converter/other/pbmtopgm.c 2018-07-23 15:03:21.380486783 +0200 ++++ b/converter/other/pbmtopgm.c 2018-07-23 15:05:03.068265754 +0200 +@@ -47,6 +47,7 @@ main(int argc, char *argv[]) { + "than the image height (%u rows)", height, rows); + + outrow = pgm_allocrow(cols) ; ++ overflow2(width, height); + maxval = MIN(PGM_OVERALLMAXVAL, width*height); + pgm_writepgminit(stdout, cols, rows, maxval, 0) ; + +diff -urNp a/converter/other/pnmtoddif.c b/converter/other/pnmtoddif.c +--- a/converter/other/pnmtoddif.c 2018-07-23 15:03:21.380486783 +0200 ++++ b/converter/other/pnmtoddif.c 2018-07-23 15:05:03.068265754 +0200 +@@ -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 -urNp a/converter/other/pnmtojpeg.c b/converter/other/pnmtojpeg.c +--- a/converter/other/pnmtojpeg.c 2018-07-23 15:03:21.387486768 +0200 ++++ b/converter/other/pnmtojpeg.c 2018-07-23 15:05:03.068265754 +0200 +@@ -606,7 +606,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); +@@ -938,6 +942,8 @@ compute_rescaling_array(JSAMPLE ** const + 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 +1022,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 -urNp a/converter/other/pnmtops.c b/converter/other/pnmtops.c +--- a/converter/other/pnmtops.c 2018-07-23 15:03:21.399486742 +0200 ++++ b/converter/other/pnmtops.c 2018-07-23 15:05:03.068265754 +0200 +@@ -294,17 +294,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; + + 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 -urNp a/converter/other/rletopnm.c b/converter/other/rletopnm.c +--- a/converter/other/rletopnm.c 2018-07-23 15:03:21.385486773 +0200 ++++ b/converter/other/rletopnm.c 2018-07-23 15:05:03.068265754 +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 <alan@redhat.com> + */ + /* + * rletopnm - A conversion program to convert from Utah's "rle" image format +diff -urNp a/converter/other/sirtopnm.c b/converter/other/sirtopnm.c +--- a/converter/other/sirtopnm.c 2018-07-23 15:03:21.398486744 +0200 ++++ b/converter/other/sirtopnm.c 2018-07-23 15:05:03.068265754 +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 -urNp a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c +--- a/converter/other/tifftopnm.c 2018-07-23 15:03:21.379486786 +0200 ++++ b/converter/other/tifftopnm.c 2018-07-23 15:05:03.068265754 +0200 +@@ -1372,7 +1372,9 @@ convertRasterByRows(pnmOut * const + if (scanbuf == NULL) + pm_error("can't allocate memory for scanline buffer"); + +- MALLOCARRAY(samplebuf, cols * spp); ++ /* samplebuf is unsigned int * !!! */ ++ samplebuf = (unsigned int *) malloc3(cols , sizeof(unsigned int) , spp); ++ + if (samplebuf == NULL) + pm_error("can't allocate memory for row buffer"); + +diff -urNp a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c +--- a/converter/other/xwdtopnm.c 2018-07-23 15:03:21.387486768 +0200 ++++ b/converter/other/xwdtopnm.c 2018-07-23 15:05:03.068265754 +0200 +@@ -210,6 +210,10 @@ processX10Header(X10WDFileHeader * cons + *colorsP = pnm_allocrow(2); + PNM_ASSIGN1((*colorsP)[0], 0); + PNM_ASSIGN1((*colorsP)[1], *maxvalP); ++ 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; +@@ -635,6 +639,7 @@ processX11Header(X11WDFileHeader * cons + + *colsP = h11FixedP->pixmap_width; + *rowsP = h11FixedP->pixmap_height; ++ overflow2(h11FixedP->bytes_per_line, 8); + *padrightP = + h11FixedP->bytes_per_line * 8 - + h11FixedP->pixmap_width * h11FixedP->bits_per_pixel; +diff -urNp a/converter/pbm/mdatopbm.c b/converter/pbm/mdatopbm.c +--- a/converter/pbm/mdatopbm.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/mdatopbm.c 2018-07-23 15:05:03.052265788 +0200 +@@ -245,10 +245,13 @@ main(int argc, char **argv) { + pm_readlittleshort(infile, &yy); nInCols = yy; + } + ++ overflow2(nOutCols, 8); + nOutCols = 8 * nInCols; + nOutRows = nInRows; +- if (bScale) ++ if (bScale) { ++ overflow2(nOutRows, 2); + nOutRows *= 2; ++ } + + data = pbm_allocarray(nOutCols, nOutRows); + +diff -urNp a/converter/pbm/mgrtopbm.c b/converter/pbm/mgrtopbm.c +--- a/converter/pbm/mgrtopbm.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/mgrtopbm.c 2018-07-23 15:05:03.052265788 +0200 +@@ -65,6 +65,8 @@ readMgrHeader(FILE * const ifP, + if (head.h_high < ' ' || head.l_high < ' ') + pm_error("Invalid width field in MGR header"); + ++ 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 -urNp a/converter/pbm/pbmtogem.c b/converter/pbm/pbmtogem.c +--- a/converter/pbm/pbmtogem.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/pbmtogem.c 2018-07-23 15:05:03.052265788 +0200 +@@ -79,6 +79,7 @@ putinit (int const rows, int const cols) + bitsperitem = 0; + bitshift = 7; + outcol = 0; ++ overflow_add(cols, 7); + outmax = (cols + 7) / 8; + outrow = (unsigned char *) pm_allocrow (outmax, sizeof (unsigned char)); + lastrow = (unsigned char *) pm_allocrow (outmax, sizeof (unsigned char)); +diff -urNp a/converter/pbm/pbmtogo.c b/converter/pbm/pbmtogo.c +--- a/converter/pbm/pbmtogo.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/pbmtogo.c 2018-07-23 15:05:03.052265788 +0200 +@@ -158,6 +158,7 @@ main(int argc, + bitrow = pbm_allocrow(cols); + + /* Round cols up to the nearest multiple of 8. */ ++ overflow_add(cols, 7); + rucols = ( cols + 7 ) / 8; + bytesperrow = rucols; /* GraphOn uses bytes */ + rucols = rucols * 8; +diff -urNp a/converter/pbm/pbmtolj.c b/converter/pbm/pbmtolj.c +--- a/converter/pbm/pbmtolj.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/pbmtolj.c 2018-07-23 15:05:03.052265788 +0200 +@@ -120,7 +120,11 @@ parseCommandLine(int argc, char ** argv, + static void + allocateBuffers(unsigned int const cols) { + ++ overflow_add(cols, 8); + rowBufferSize = (cols + 7) / 8; ++ overflow_add(rowBufferSize, 128); ++ overflow_add(rowBufferSize, rowBufferSize+128); ++ overflow_add(rowBufferSize+10, rowBufferSize/8); + packBufferSize = rowBufferSize + (rowBufferSize + 127) / 128 + 1; + deltaBufferSize = rowBufferSize + rowBufferSize / 8 + 10; + +diff -urNp a/converter/pbm/pbmtomda.c b/converter/pbm/pbmtomda.c +--- a/converter/pbm/pbmtomda.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/pbmtomda.c 2018-07-23 15:05:03.052265788 +0200 +@@ -179,6 +179,7 @@ int main(int argc, char **argv) + + nOutRowsUnrounded = bScale ? nInRows/2 : nInRows; + ++ overflow_add(nOutRowsUnrounded, 3); + nOutRows = ((nOutRowsUnrounded + 3) / 4) * 4; + /* MDA wants rows a multiple of 4 */ + nOutCols = nInCols / 8; +diff -urNp a/converter/pbm/pbmtoppa/pbm.c b/converter/pbm/pbmtoppa/pbm.c +--- a/converter/pbm/pbmtoppa/pbm.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/pbmtoppa/pbm.c 2018-07-23 15:05:03.051265791 +0200 +@@ -106,6 +106,7 @@ int pbm_readline(pbm_stat* pbm,unsigned + return 0; + + 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 + 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--; +diff -urNp a/converter/pbm/pbmtoppa/pbmtoppa.c b/converter/pbm/pbmtoppa/pbmtoppa.c +--- a/converter/pbm/pbmtoppa/pbmtoppa.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/pbmtoppa/pbmtoppa.c 2018-07-23 15:05:03.051265791 +0200 +@@ -453,6 +453,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; + +diff -urNp a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c +--- a/converter/pbm/pbmtoxbm.c 2018-07-23 15:03:21.376486792 +0200 ++++ b/converter/pbm/pbmtoxbm.c 2018-07-23 15:05:03.053265786 +0200 +@@ -352,6 +352,8 @@ convertRaster(FILE * const ifP, + + unsigned char * bitrow; + unsigned int row; ++ ++ overflow_add(cols, padright); + + putinit(xbmVersion); + +diff -urNp a/converter/pbm/pbmto4425.c b/converter/pbm/pbmto4425.c +--- a/converter/pbm/pbmto4425.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/pbmto4425.c 2018-07-23 15:05:03.052265788 +0200 +@@ -2,6 +2,7 @@ + + #include "nstring.h" + #include "pbm.h" ++#include <string.h> + + 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 -urNp a/converter/pbm/pktopbm.c b/converter/pbm/pktopbm.c +--- a/converter/pbm/pktopbm.c 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/pktopbm.c 2018-07-23 15:05:03.053265786 +0200 +@@ -280,6 +280,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 -urNp a/converter/pbm/thinkjettopbm.l b/converter/pbm/thinkjettopbm.l +--- a/converter/pbm/thinkjettopbm.l 2018-07-23 15:03:21.377486790 +0200 ++++ b/converter/pbm/thinkjettopbm.l 2018-07-23 15:05:03.053265786 +0200 +@@ -114,7 +114,9 @@ DIG [0-9] + <RASTERMODE>\033\*b{DIG}+W { + int l; + if (rowCount >= rowCapacity) { +- rowCapacity += 100; ++ overflow_add(rowCapacity, 100); ++ rowCapacity += 100; ++ overflow2(rowCapacity, sizeof *rows); + rows = realloc (rows, rowCapacity * sizeof *rows); + if (rows == NULL) + pm_error ("Out of memory."); +@@ -226,6 +228,8 @@ 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 -urNp a/converter/pbm/ybmtopbm.c b/converter/pbm/ybmtopbm.c +--- a/converter/pbm/ybmtopbm.c 2018-07-23 15:03:21.378486788 +0200 ++++ b/converter/pbm/ybmtopbm.c 2018-07-23 15:05:03.053265786 +0200 +@@ -43,6 +43,7 @@ getinit(FILE * const ifP, + pm_error("EOF / read error"); + + *depthP = 1; ++ overflow_add(*colsP, 15); + } + + +diff -urNp a/converter/pgm/lispmtopgm.c b/converter/pgm/lispmtopgm.c +--- a/converter/pgm/lispmtopgm.c 2018-07-23 15:03:21.400486740 +0200 ++++ b/converter/pgm/lispmtopgm.c 2018-07-23 15:05:03.069265751 +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,6 +103,8 @@ getinit( file, colsP, rowsP, depthP, pad + + if ( *depthP == 0 ) + *depthP = 1; /* very old file */ ++ ++ overflow_add((int)colsP, 31); + + *padrightP = ( ( *colsP + 31 ) / 32 ) * 32 - *colsP; + +diff -urNp a/converter/pgm/psidtopgm.c b/converter/pgm/psidtopgm.c +--- a/converter/pgm/psidtopgm.c 2018-07-23 15:03:21.400486740 +0200 ++++ b/converter/pgm/psidtopgm.c 2018-07-23 15:05:03.069265751 +0200 +@@ -78,6 +78,7 @@ main(int argc, + pm_error("bits/sample (%d) is too large.", bitspersample); + + 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 -urNp a/converter/ppm/ilbmtoppm.c b/converter/ppm/ilbmtoppm.c +--- a/converter/ppm/ilbmtoppm.c 2018-07-23 15:03:21.403486734 +0200 ++++ b/converter/ppm/ilbmtoppm.c 2018-07-23 15:08:45.446313490 +0200 +@@ -608,6 +608,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; +@@ -695,6 +696,23 @@ decode_mask(FILE * const ifP, + Multipalette handling + ****************************************************************************/ + ++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(ColorMap * const cmapP, +@@ -1363,6 +1381,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); +@@ -1802,7 +1823,9 @@ PCHG_ConvertSmall(PCHGHeader * const + ChangeCount32 = *data++; + remDataSize -= 2; + ++ overflow_add(ChangeCount16, ChangeCount32); + changes = ChangeCount16 + ChangeCount32; ++ overflow_add(changes, 1); + for (i = 0; i < changes; ++i) { + if (totalchanges >= pchgP->TotalChanges) goto fail; + if (remDataSize < 2) goto fail; +@@ -2067,6 +2090,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++ ) +@@ -2143,6 +2169,7 @@ process_body( FILE * const ifP, + if (typeid == ID_ILBM) { + int isdeep; + ++ overflow_add(bmhdP->w, 15); + MALLOCARRAY_NOFAIL(ilbmrow, RowBytes(bmhdP->w)); + *viewportmodesP |= fakeviewport; /* -isham/-isehb */ + +diff -urNp a/converter/ppm/ilbmtoppm.c.rej b/converter/ppm/ilbmtoppm.c.rej +--- a/converter/ppm/ilbmtoppm.c.rej 1970-01-01 01:00:00.000000000 +0100 ++++ b/converter/ppm/ilbmtoppm.c.rej 2018-07-23 15:05:03.071265747 +0200 +@@ -0,0 +1,46 @@ ++--- converter/ppm/ilbmtoppm.c +++++ converter/ppm/ilbmtoppm.c ++@@ -694,6 +695,23 @@ decode_mask(FILE * const ifP, ++ Multipalette handling ++ ****************************************************************************/ ++ +++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) ++@@ -1356,6 +1374,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); ++@@ -1785,7 +1806,9 @@ PCHG_ConvertSmall(PCHG, cmap, mask, datasize) ++ ChangeCount32 = *data++; ++ datasize -= 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; +diff -urNp a/converter/ppm/imgtoppm.c b/converter/ppm/imgtoppm.c +--- a/converter/ppm/imgtoppm.c 2018-07-23 15:03:21.404486731 +0200 ++++ b/converter/ppm/imgtoppm.c 2018-07-23 15:05:03.071265747 +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" ); ++ overflow2(cmaplen, 3); + if ( cmaplen * 3 != len ) + { + pm_message( +@@ -105,6 +106,7 @@ main(int argc, char ** argv) { + pm_error( "bad pixel data header" ); + buf[8] = '\0'; + len = atoi((char*) buf ); ++ overflow2(cols, rows); + if ( len != cols * rows ) + pm_message( + "pixel data length (%d) does not match image size (%d)", +diff -urNp a/converter/ppm/Makefile b/converter/ppm/Makefile +--- a/converter/ppm/Makefile 2018-07-23 15:03:21.406486727 +0200 ++++ b/converter/ppm/Makefile 2018-07-23 15:05:03.071265747 +0200 +@@ -11,7 +11,7 @@ SUBDIRS = hpcdtoppm + + PORTBINARIES = 411toppm eyuvtoppm gouldtoppm ilbmtoppm imgtoppm \ + leaftoppm mtvtoppm neotoppm \ +- pcxtoppm pc1toppm pi1toppm picttoppm pjtoppm \ ++ pcxtoppm pc1toppm pi1toppm pjtoppm \ + ppmtoacad ppmtoapplevol ppmtoarbtxt ppmtoascii \ + ppmtobmp ppmtoeyuv ppmtogif ppmtoicr ppmtoilbm \ + ppmtoleaf ppmtolj ppmtomitsu ppmtoneo \ +diff -urNp a/converter/ppm/pcxtoppm.c b/converter/ppm/pcxtoppm.c +--- a/converter/ppm/pcxtoppm.c 2018-07-23 15:03:21.406486727 +0200 ++++ b/converter/ppm/pcxtoppm.c 2018-07-23 15:05:03.071265747 +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, + } + + /* BytesPerLine should be >= BitsPerPixel * cols / 8 */ ++ overflow2(BytesPerLine, 8); + rawcols = BytesPerLine * 8 / BitsPerPixel; + if (headerCols > rawcols) { + pm_message("warning - BytesPerLine = %d, " +diff -urNp a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c +--- a/converter/ppm/picttoppm.c 2018-07-23 15:03:21.404486731 +0200 ++++ b/converter/ppm/picttoppm.c 2018-07-23 15:05:03.071265747 +0200 +@@ -1,3 +1,4 @@ ++#error "Unfixable. Don't ship me" + /* + * picttoppm.c -- convert a MacIntosh PICT file to PPM format. + * +diff -urNp a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c +--- a/converter/ppm/pjtoppm.c 2018-07-23 15:03:21.402486736 +0200 ++++ b/converter/ppm/pjtoppm.c 2018-07-23 15:05:03.071265747 +0200 +@@ -127,20 +127,22 @@ 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 { +- 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"); +@@ -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++) { + 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); + } + } ++ overflow2(cols, 8); + cols *= 8; + } + +diff -urNp a/converter/ppm/ppmtoeyuv.c b/converter/ppm/ppmtoeyuv.c +--- a/converter/ppm/ppmtoeyuv.c 2018-07-23 15:03:21.404486731 +0200 ++++ b/converter/ppm/ppmtoeyuv.c 2018-07-23 15:05:03.071265747 +0200 +@@ -114,6 +114,7 @@ create_multiplication_tables(const pixva + + int index; + ++ overflow_add(maxval, 1); + MALLOCARRAY_NOFAIL(mult299 , maxval+1); + MALLOCARRAY_NOFAIL(mult587 , maxval+1); + MALLOCARRAY_NOFAIL(mult114 , maxval+1); +diff -urNp a/converter/ppm/ppmtolj.c b/converter/ppm/ppmtolj.c +--- a/converter/ppm/ppmtolj.c 2018-07-23 15:03:21.401486738 +0200 ++++ b/converter/ppm/ppmtolj.c 2018-07-23 15:05:03.071265747 +0200 +@@ -182,6 +182,7 @@ int main(int argc, char *argv[]) { + ppm_readppminit( ifp, &cols, &rows, &maxval, &format ); + pixelrow = ppm_allocrow( cols ); + ++ overflow2(cols, 6); + obuf = (unsigned char *) pm_allocrow(cols * 3, sizeof(unsigned char)); + cbuf = (unsigned char *) pm_allocrow(cols * 6, sizeof(unsigned char)); + if (mode == C_TRANS_MODE_DELTA) +diff -urNp a/converter/ppm/ppmtomitsu.c b/converter/ppm/ppmtomitsu.c +--- a/converter/ppm/ppmtomitsu.c 2018-07-23 15:03:21.403486734 +0200 ++++ b/converter/ppm/ppmtomitsu.c 2018-07-23 15:05:03.071265747 +0200 +@@ -685,6 +685,8 @@ main(int argc, char * argv[]) { + medias = MSize_User; + + if (dpi300) { ++ overflow2(medias.maxcols, 2); ++ overflow2(medias.maxrows, 2); + medias.maxcols *= 2; + medias.maxrows *= 2; + } +diff -urNp a/converter/ppm/ppmtopcx.c b/converter/ppm/ppmtopcx.c +--- a/converter/ppm/ppmtopcx.c 2018-07-23 15:03:21.403486734 +0200 ++++ b/converter/ppm/ppmtopcx.c 2018-07-23 15:05:03.071265747 +0200 +@@ -425,6 +425,8 @@ ppmTo16ColorPcx(pixel ** cons + else Planes = 1; + } + } ++ overflow2(BitsPerPixel, cols); ++ overflow_add(BitsPerPixel * cols, 7); + BytesPerLine = ((cols * BitsPerPixel) + 7) / 8; + MALLOCARRAY_NOFAIL(indexRow, cols); + MALLOCARRAY_NOFAIL(planesrow, BytesPerLine); +diff -urNp a/converter/ppm/ppmtopict.c b/converter/ppm/ppmtopict.c +--- a/converter/ppm/ppmtopict.c 2018-07-23 15:03:21.402486736 +0200 ++++ b/converter/ppm/ppmtopict.c 2018-07-23 15:05:03.071265747 +0200 +@@ -450,6 +450,8 @@ main(int argc, const char ** argv) { + putShort(stdout, 0); /* mode */ + + /* Finally, write out the data. */ ++ overflow_add(cols/MAX_COUNT, 1); ++ overflow_add(cols, cols/MAX_COUNT+1); + outBuf = malloc((unsigned)(cols+cols/MAX_COUNT+1)); + for (row = 0, oc = 0; row < rows; ++row) { + unsigned int rowSize; +diff -urNp a/converter/ppm/ppmtopj.c b/converter/ppm/ppmtopj.c +--- a/converter/ppm/ppmtopj.c 2018-07-23 15:03:21.405486729 +0200 ++++ b/converter/ppm/ppmtopj.c 2018-07-23 15:05:03.071265747 +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 -urNp a/converter/ppm/ppmtopjxl.c b/converter/ppm/ppmtopjxl.c +--- a/converter/ppm/ppmtopjxl.c 2018-07-23 15:03:21.405486729 +0200 ++++ b/converter/ppm/ppmtopjxl.c 2018-07-23 15:05:03.071265747 +0200 +@@ -267,6 +267,9 @@ main(int argc, const char * argv[]) { + 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..."); + chv = ppm_computecolorhist(pixels, cols, rows, MAXCOLORS, &colors); +@@ -286,6 +289,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 */ +@@ -295,9 +300,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 -urNp a/converter/ppm/ppmtowinicon.c b/converter/ppm/ppmtowinicon.c +--- a/converter/ppm/ppmtowinicon.c 2018-07-23 15:03:21.405486729 +0200 ++++ b/converter/ppm/ppmtowinicon.c 2018-07-23 15:05:03.071265747 +0200 +@@ -12,6 +12,7 @@ + + #include <math.h> + #include <string.h> ++#include <stdlib.h> + + #include "pm_c_util.h" + #include "winico.h" +@@ -214,6 +215,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; +@@ -342,6 +344,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++) { +@@ -402,6 +405,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++) { +@@ -709,7 +713,11 @@ addEntryToIcon(MS_Ico const MSIcon + entry->bitcount = bpp; + entry->ih = createInfoHeader(entry, xorBitmap, andBitmap); + entry->colors = palette->colors; +- entry->size_in_bytes = ++ 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) + pm_message("entry->size_in_bytes = %d + %d + %d = %d", +diff -urNp a/converter/ppm/ppmtoxpm.c b/converter/ppm/ppmtoxpm.c +--- a/converter/ppm/ppmtoxpm.c 2018-07-23 15:03:21.405486729 +0200 ++++ b/converter/ppm/ppmtoxpm.c 2018-07-23 15:05:03.071265747 +0200 +@@ -198,6 +198,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"); + +@@ -315,6 +316,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 -urNp a/converter/ppm/qrttoppm.c b/converter/ppm/qrttoppm.c +--- a/converter/ppm/qrttoppm.c 2018-07-23 15:03:21.406486727 +0200 ++++ b/converter/ppm/qrttoppm.c 2018-07-23 15:05:03.071265747 +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 -urNp a/converter/ppm/sldtoppm.c b/converter/ppm/sldtoppm.c +--- a/converter/ppm/sldtoppm.c 2018-07-23 15:03:21.401486738 +0200 ++++ b/converter/ppm/sldtoppm.c 2018-07-23 15:05:03.071265747 +0200 +@@ -154,127 +154,85 @@ vscale(int * const px, + + + +-static void +-upcase(const char * const sname, +- char * const uname) { +- +- unsigned int i; +- const char * ip; +- +- for (i = 0, ip = sname; i < 31; ++i) { +- char const ch = *ip++; +- +- if (ch != EOS) +- uname[i] = islower(ch) ? toupper(ch) : ch; +- } +- uname[i] = EOS; +-} +- +- +- +-static void +-skipBytes(FILE * const fileP, +- unsigned int const count) { +- +- unsigned int i; +- +- for (i = 0; i < count; ++i) +- getc(fileP); +-} +- +- +- +-static void +-scanDirectory(FILE * const slFileP, +- long const dirPos, +- bool const dirOnly, +- const char * const uname, +- bool * const foundP) { +-/*---------------------------------------------------------------------------- +- Scan the directory at the current position in *slFileP, either listing +- the directory ('dirOnly' true) or searching for a slide named +- 'uname' ('dirOnly' false). +- +- 'dirPos' is the offset in the file of the directory, i.e. the current +- position of *slFileP. +- +- In the latter case, return as *foundP whether the slide name is there. +------------------------------------------------------------------------------*/ +- bool found; +- bool eof; +- long pos; +- unsigned char libent[36]; +- +- for (found = false, eof = false, pos = dirPos; !found && !eof; ) { +- size_t readCt; +- readCt = fread(libent, 36, 1, slFileP); +- if (readCt != 1) +- eof = true; +- else { +- /* The directory entry is 32 bytes of NUL-terminated slide name +- followed by 4 bytes of offset of the next directory entry. +- */ +- const char * const slideName = (const char *)(&libent[0]); +- if (pm_strnlen(slideName, 32) == 32) +- pm_error("Invalid input: slide name field is not " +- "nul-terminated"); +- else { +- if (strlen(slideName) == 0) +- eof = true; +- else { +- pos += 36; +- if (dirOnly) { +- pm_message(" %s", slideName); +- } else if (streq(slideName, uname)) { +- long const dpos = +- (((((libent[35] << 8) | libent[34]) << 8) | +- libent[33]) << 8) | libent[32]; +- +- if ((slFileP == stdin) || +- (fseek(slFileP, dpos, 0) == -1)) { +- +- skipBytes(slFileP, dpos - pos); +- } +- found = true; +- } +- } +- } +- } +- } +- *foundP = found; +-} +- + /* SLIDEFIND -- Find a slide in a library or, if DIRONLY is + nonzero, print a directory listing of the library. + If UCASEN is nonzero, the requested slide name is + converted to upper case. */ + + static void +-slidefind(const char * const slideName, +- bool const dirOnly, ++slidefind(const char * const sname, ++ bool const dironly, + bool const ucasen) { + +- char uname[32]; /* upper case translation of 'slideName' */ +- char header[32]; /* (supposed) header read from file */ ++ char uname[32]; ++ unsigned char libent[36]; ++ long pos; + bool found; ++ bool eof; + +- if (dirOnly) ++ if (dironly) + pm_message("Slides in library:"); + else { +- upcase(slideName, uname); ++ unsigned int i; ++ const char * ip; ++ ++ ip = sname; /* initial value */ ++ ++ for (i = 0; i < 31; ++i) { ++ char const ch = *ip++; ++ if (ch == EOS) ++ break; ++ ++ { ++ char const upperCh = ++ ucasen && islower(ch) ? toupper(ch) : ch; ++ ++ uname[i] = upperCh; ++ } ++ } ++ uname[i] = EOS; + } + + /* Read slide library header and verify. */ +- +- if ((fread(header, 32, 1, slfile) != 1) || +- (!STRSEQ(header, "AutoCAD Slide Library 1.0\r\n\32"))) { ++ ++ if ((fread(libent, 32, 1, slfile) != 1) || ++ (!streq((char *)libent, "AutoCAD Slide Library 1.0\015\012\32"))) { + pm_error("not an AutoCAD slide library file."); + } ++ pos = 32; ++ ++ /* Search for a slide with the requested name or list the directory */ ++ ++ for (found = false, eof = false; !found && !eof; ) { ++ size_t readCt; ++ readCt = fread(libent, 36, 1, slfile); ++ if (readCt != 1) ++ eof = true; ++ else if (strlen((char *)libent) == 0) ++ eof = true; ++ } ++ if (!eof) { ++ pos += 36; ++ if (dironly) { ++ pm_message(" %s", libent); ++ } else if (streq((char *)libent, uname)) { ++ long dpos; ++ ++ dpos = (((((libent[35] << 8) | libent[34]) << 8) | ++ libent[33]) << 8) | libent[32]; ++ ++ if ((slfile == stdin) || (fseek(slfile, dpos, 0) == -1)) { ++ dpos -= pos; ++ ++ while (dpos-- > 0) ++ getc(slfile); ++ } ++ found = true; ++ } ++ } + +- scanDirectory(slfile, 32, dirOnly, ucasen ? uname : slideName, &found); +- +- if (!found && !dirOnly) +- pm_error("slide '%s' not in library.", slideName); ++ if (!found && !dironly) ++ pm_error("slide '%s' not in library.", sname); + } + + +@@ -392,7 +350,7 @@ slider(slvecfn slvec, + + /* Verify that slide format is compatible with this program. */ + +- if (!STRSEQ(slfrof.slh, slhi.slh)) ++ if (streq(slfrof.slh, slhi.slh)) + pm_error("this is not an AutoCAD slide file."); + + /* Verify that the number format and file level in the header are +@@ -506,6 +464,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 -urNp a/converter/ppm/ximtoppm.c b/converter/ppm/ximtoppm.c +--- a/converter/ppm/ximtoppm.c 2018-07-23 15:03:21.402486736 +0200 ++++ b/converter/ppm/ximtoppm.c 2018-07-23 15:05:03.071265747 +0200 +@@ -118,6 +118,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" ); +@@ -127,6 +128,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); +@@ -135,6 +137,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" ); +@@ -161,6 +164,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 -urNp a/editor/pamcut.c b/editor/pamcut.c +--- a/editor/pamcut.c 2018-07-23 15:03:21.362486822 +0200 ++++ b/editor/pamcut.c 2018-07-23 15:05:03.046265802 +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; + +diff -urNp a/editor/pnmgamma.c b/editor/pnmgamma.c +--- a/editor/pnmgamma.c 2018-07-23 15:03:21.364486818 +0200 ++++ b/editor/pnmgamma.c 2018-07-23 15:05:03.046265802 +0200 +@@ -596,6 +596,7 @@ createGammaTables(enum transferFunction + xelval ** const btableP) { + + /* Allocate space for the tables. */ ++ overflow_add(maxval, 1); + MALLOCARRAY(*rtableP, maxval+1); + MALLOCARRAY(*gtableP, maxval+1); + MALLOCARRAY(*btableP, maxval+1); +diff -urNp a/editor/pnmhisteq.c b/editor/pnmhisteq.c +--- a/editor/pnmhisteq.c 2018-07-23 15:03:21.362486822 +0200 ++++ b/editor/pnmhisteq.c 2018-07-23 15:05:03.046265802 +0200 +@@ -107,6 +107,7 @@ computeLuminosityHistogram(xel * const * + unsigned int pixelCount; + unsigned int * lumahist; + ++ overflow_add(maxval, 1); + MALLOCARRAY(lumahist, maxval + 1); + if (lumahist == NULL) + pm_error("Out of storage allocating array for %u histogram elements", +diff -urNp a/editor/pnmindex.csh b/editor/pnmindex.csh +--- a/editor/pnmindex.csh 2018-07-23 15:03:21.369486807 +0200 ++++ b/editor/pnmindex.csh 2018-07-23 15:05:03.046265802 +0200 +@@ -1,5 +1,7 @@ + #!/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 -urNp a/editor/pnmpad.c b/editor/pnmpad.c +--- a/editor/pnmpad.c 2018-07-23 15:03:21.362486822 +0200 ++++ b/editor/pnmpad.c 2018-07-23 15:05:03.046265802 +0200 +@@ -634,6 +634,8 @@ main(int argc, const char ** argv) { + + computePadSizes(cmdline, cols, rows, &lpad, &rpad, &tpad, &bpad); + ++ overflow_add(cols, lpad); ++ overflow_add(cols + lpad, rpad); + newcols = cols + lpad + rpad; + + if (PNM_FORMAT_TYPE(format) == PBM_TYPE) +diff -urNp a/editor/pnmremap.c b/editor/pnmremap.c +--- a/editor/pnmremap.c 2018-07-23 15:03:21.363486820 +0200 ++++ b/editor/pnmremap.c 2018-07-23 15:09:26.462101272 +0200 +@@ -468,6 +468,7 @@ fserr_init(struct pam * const pamP, + + unsigned int const fserrSize = pamP->width + 2; + ++ overflow_add(pamP->width, 2); + fserrP->width = pamP->width; + + MALLOCARRAY(fserrP->thiserr, pamP->depth); +@@ -506,6 +507,7 @@ floydInitRow(struct pam * const pamP, + + unsigned 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 -urNp a/editor/pnmremap.c.rej b/editor/pnmremap.c.rej +--- a/editor/pnmremap.c.rej 1970-01-01 01:00:00.000000000 +0100 ++++ b/editor/pnmremap.c.rej 2018-07-23 15:05:03.046265802 +0200 +@@ -0,0 +1,10 @@ ++--- editor/pnmremap.c +++++ editor/pnmremap.c ++@@ -506,6 +507,7 @@ floydInitRow(struct pam * const pamP, struct Fserr * const fserrP) { ++ ++ 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 -urNp a/editor/pnmscalefixed.c b/editor/pnmscalefixed.c +--- a/editor/pnmscalefixed.c 2018-07-23 15:03:21.365486816 +0200 ++++ b/editor/pnmscalefixed.c 2018-07-23 15:05:03.046265802 +0200 +@@ -214,6 +214,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) { + *newrowsP = rows; +@@ -265,6 +266,8 @@ compute_output_dimensions(const struct c + + if (*newcolsP < 1) *newcolsP = 1; + if (*newrowsP < 1) *newrowsP = 1; ++ ++ overflow2(*newcolsP, *newrowsP); + } + + +@@ -446,6 +449,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. + */ ++ ++ overflow2(newcols, SCALE); ++ overflow2(newrows, SCALE); + sxscale = SCALE * newcols / cols; + syscale = SCALE * newrows / rows; + +diff -urNp a/editor/ppmdither.c b/editor/ppmdither.c +--- a/editor/ppmdither.c 2018-07-23 15:03:21.363486820 +0200 ++++ b/editor/ppmdither.c 2018-07-23 15:05:03.046265802 +0200 +@@ -356,6 +356,11 @@ dithMatrix(unsigned int const dithPower) + (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 -urNp a/editor/specialty/pamoil.c b/editor/specialty/pamoil.c +--- a/editor/specialty/pamoil.c 2018-07-23 15:03:21.366486814 +0200 ++++ b/editor/specialty/pamoil.c 2018-07-23 15:05:03.045265804 +0200 +@@ -112,6 +112,7 @@ main(int argc, char *argv[] ) { + tuples = pnm_readpam(ifp, &inpam, PAM_STRUCT_SIZE(tuple_type)); + pm_close(ifp); + ++ overflow_add(inpam.maxval, 1); + MALLOCARRAY(hist, inpam.maxval + 1); + if (hist == NULL) + pm_error("Unable to allocate memory for histogram."); +diff -urNp a/lib/libpam.c b/lib/libpam.c +--- a/lib/libpam.c 2018-07-23 15:03:21.373486799 +0200 ++++ b/lib/libpam.c 2018-07-23 15:05:03.050265793 +0200 +@@ -225,7 +225,8 @@ 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)); + + if (tuplerow != NULL) { + /* Now we initialize the pointers to the individual tuples +diff -urNp a/lib/libpammap.c b/lib/libpammap.c +--- a/lib/libpammap.c 2018-07-23 15:03:21.373486799 +0200 ++++ b/lib/libpammap.c 2018-07-23 15:05:03.050265793 +0200 +@@ -108,7 +108,9 @@ allocTupleIntListItem(struct pam * const + */ + struct tupleint_list_item * retval; + +- unsigned int const size = ++ 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) + + pamP->depth * sizeof(sample); + +diff -urNp a/lib/libpm.c b/lib/libpm.c +--- a/lib/libpm.c 2018-07-23 15:03:21.372486801 +0200 ++++ b/lib/libpm.c 2018-07-23 15:05:03.050265793 +0200 +@@ -888,5 +888,53 @@ pm_parse_height(const char * const arg) + return height; + } + ++/* ++ * 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"); ++} ++ ++void overflow3(int a, int b, int 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"); ++} ++ ++void *malloc2(int a, int 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); ++} ++ ++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); ++} + +diff -urNp a/lib/pm.h b/lib/pm.h +--- a/lib/pm.h 2018-07-23 15:03:21.376486792 +0200 ++++ b/lib/pm.h 2018-07-23 15:05:03.050265793 +0200 +@@ -435,5 +435,12 @@ pm_parse_height(const char * const arg); + } + #endif + ++void *malloc2(int, int); ++void *malloc3(int, int, int); ++#define overflow2(a,b) __overflow2(a,b) ++void __overflow2(int, int); ++void overflow3(int, int, int); ++void overflow_add(int, int); ++ + + #endif +diff -urNp a/other/pnmcolormap.c b/other/pnmcolormap.c +--- a/other/pnmcolormap.c 2018-07-23 15:03:21.362486822 +0200 ++++ b/other/pnmcolormap.c 2018-07-23 15:05:03.041265812 +0200 +@@ -840,6 +840,7 @@ colormapToSquare(struct pam * const pamP + pamP->width = intsqrt; + else + pamP->width = intsqrt + 1; ++ overflow_add(intsqrt, 1); + } + { + unsigned int const intQuotient = colormap.size / pamP->width; +diff -urNp a/urt/rle_addhist.c b/urt/rle_addhist.c +--- a/urt/rle_addhist.c 2018-07-23 15:03:21.419486699 +0200 ++++ b/urt/rle_addhist.c 2018-07-23 15:05:03.072265745 +0200 +@@ -70,13 +70,18 @@ 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. */ +- ++ 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... */ +@@ -84,8 +89,10 @@ rle_addhist(char * argv[], + else + old = NULL; + +- if (old && *old) ++ if (old && *old) { ++ overflow_add(length, strlen(old)); + length += strlen(old); /* add length if there. */ ++ } + + ++length; /*Cater for the null. */ + +diff -urNp a/urt/rle_getrow.c b/urt/rle_getrow.c +--- a/urt/rle_getrow.c 2018-07-23 15:03:21.418486701 +0200 ++++ b/urt/rle_getrow.c 2018-07-23 15:05:03.072265745 +0200 +@@ -160,6 +160,7 @@ rle_get_setup(rle_hdr * const the_hdr) { + char * cp; + + VAXSHORT(comlen, infile); /* get comment length */ ++ overflow_add(comlen, 1); + evenlen = (comlen + 1) & ~1; /* make it even */ + if (evenlen) { + MALLOCARRAY(comment_buf, evenlen); +diff -urNp a/urt/rle.h b/urt/rle.h +--- a/urt/rle.h 2018-07-23 15:03:21.418486701 +0200 ++++ b/urt/rle.h 2018-07-23 15:05:03.072265745 +0200 +@@ -161,6 +161,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); ++extern void overflow3(int, int, int); ++extern void *malloc2(int, int); ++extern void *malloc3(int, int, int); ++extern void *realloc2(void *, int, int); + + /* Declare RLE library routines. */ + +diff -urNp a/urt/rle_hdr.c b/urt/rle_hdr.c +--- a/urt/rle_hdr.c 2018-07-23 15:03:21.418486701 +0200 ++++ b/urt/rle_hdr.c 2018-07-23 15:05:03.072265745 +0200 +@@ -80,7 +80,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,8 +91,10 @@ int img_num; + + if ( the_hdr->file_name != fname ) + { +- char *tmp = (char *)malloc( strlen( fname ) + 1 ); +- RLE_CHECK_ALLOC( pgmname, tmp, 0 ); ++ 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 +158,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 +167,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<<to_hdr->cmaplen, sizeof(rle_map)); + RLE_CHECK_ALLOC( to_hdr->cmd, to_hdr->cmap, "color map" ); + memcpy( to_hdr->cmap, from_hdr->cmap, size ); + } +@@ -173,12 +179,17 @@ rle_hdr *from_hdr, *to_hdr; + { + int size = 0; + CONST_DECL char **cp; +- for ( cp=to_hdr->comments; *cp; 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 -urNp a/urt/rle_open_f.c b/urt/rle_open_f.c +--- a/urt/rle_open_f.c 2018-07-23 15:03:21.418486701 +0200 ++++ b/urt/rle_open_f.c 2018-07-23 15:05:03.072265745 +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_putcom.c b/urt/rle_putcom.c +--- a/urt/rle_putcom.c 2018-07-23 15:03:21.418486701 +0200 ++++ b/urt/rle_putcom.c 2018-07-23 15:05:03.072265745 +0200 +@@ -98,12 +98,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 +diff -urNp a/urt/Runput.c b/urt/Runput.c +--- a/urt/Runput.c 2018-07-23 15:03:21.418486701 +0200 ++++ b/urt/Runput.c 2018-07-23 15:05:03.072265745 +0200 +@@ -202,10 +202,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 int *bg_color; +- /* ++ 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 +225,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 -urNp a/urt/scanargs.c b/urt/scanargs.c +--- a/urt/scanargs.c 2018-07-23 15:03:21.418486701 +0200 ++++ b/urt/scanargs.c 2018-07-23 15:05:03.072265745 +0200 +@@ -62,9 +62,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 ) ) + static CONST_DECL char * prformat( CONST_DECL char *, int ); + static int isnum( CONST_DECL char *, int, int ); + static int _do_scanargs( int argc, char **argv, CONST_DECL char *format, diff --git a/source/l/netpbm/netpbm-security-scripts.patch b/source/l/netpbm/netpbm-security-scripts.patch new file mode 100644 index 000000000..0ba822ad1 --- /dev/null +++ b/source/l/netpbm/netpbm-security-scripts.patch @@ -0,0 +1,267 @@ +diff --git a/editor/ppmfade b/editor/ppmfade +index dcd7bf2..5091651 100755 +--- a/editor/ppmfade ++++ b/editor/ppmfade +@@ -40,6 +40,7 @@ exec perl -w -x -S -- "$0" "$@" + # + ############################################################################## + use strict; ++use File::Temp "tempdir"; + + sub doVersionHack($) { + my ($argvR) = @_; +@@ -149,20 +150,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"); + } + + # +@@ -170,14 +177,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++) { +@@ -185,147 +192,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/source/l/netpbm/netpbm-time.patch b/source/l/netpbm/netpbm-time.patch new file mode 100644 index 000000000..680bf8893 --- /dev/null +++ b/source/l/netpbm/netpbm-time.patch @@ -0,0 +1,21 @@ +diff -up netpbm-10.47.05/converter/other/fiasco/config.h.time netpbm-10.47.05/converter/other/fiasco/config.h +--- netpbm-10.47.05/converter/other/fiasco/config.h.time 2009-12-10 08:34:36.000000000 +0100 ++++ netpbm-10.47.05/converter/other/fiasco/config.h 2009-12-10 08:43:54.000000000 +0100 +@@ -19,7 +19,7 @@ + #define STDC_HEADERS 1 + + /* Define if you can safely include both <sys/time.h> and <time.h>. */ +-#define TIME_WITH_SYS_TIME 1 ++/* #undef TIME_WITH_SYS_TIME */ + + /* Define if the X Window System is missing or not being used. */ + #define X_DISPLAY_MISSING 1 +@@ -75,7 +75,7 @@ + #define HAVE_STRING_H 1 + + /* Define if you have the <sys/time.h> header file. */ +-#define HAVE_SYS_TIME_H 1 ++/* #undef HAVE_SYS_TIME_H */ + + /* Define if you have the <unistd.h> header file. */ + #define HAVE_UNISTD_H 1 diff --git a/source/l/netpbm/netpbm-xwdfix.patch b/source/l/netpbm/netpbm-xwdfix.patch new file mode 100644 index 000000000..88626c754 --- /dev/null +++ b/source/l/netpbm/netpbm-xwdfix.patch @@ -0,0 +1,11 @@ +--- netpbm-10.35/converter/other/xwdtopnm.c.xwdfix 2006-09-18 13:24:50.000000000 +0200 ++++ netpbm-10.35/converter/other/xwdtopnm.c 2006-09-18 13:27:26.000000000 +0200 +@@ -945,7 +945,7 @@ getpix(pixelReader * const rdrP) { + unsigned long const bitsToTakeMask = lsbmask[nBitsToTake]; + /* E.g. if nbitsToTake is 4, this is 0x0000000F */ + +- unsigned long bitsToTake; ++ unsigned int bitsToTake; + /* The actual bits we take, in the 'nBitsToTake' low bits */ + + assert(nBitsToTake <= 32); diff --git a/source/l/netpbm/netpbm.SlackBuild b/source/l/netpbm/netpbm.SlackBuild index 962748eca..3d08f1b0c 100755 --- a/source/l/netpbm/netpbm.SlackBuild +++ b/source/l/netpbm/netpbm.SlackBuild @@ -23,8 +23,8 @@ cd $(dirname $0) ; CWD=$(pwd) PKGNAM=netpbm -VERSION=${VERSION:-10.66.02} -BUILD=${BUILD:-5} +VERSION=${VERSION:-10.84.02} +BUILD=${BUILD:-1} # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then @@ -44,6 +44,8 @@ if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then exit 0 fi +NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} + if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" @@ -65,11 +67,51 @@ mkdir -p $TMP # Do not create $PKG or 'make package' fails cd $TMP rm -rf ${PKGNAM}-${VERSION} -tar xvf $CWD/${PKGNAM}-$VERSION.tar.?z* || exit 1 +tar xvf $CWD/${PKGNAM}-$VERSION.tar.?z || exit 1 cd ${PKGNAM}-$VERSION +zcat $CWD/netpbm-security-scripts.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-security-code.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-ppmfadeusage.patch.gz | patch -p1 --verbose || exit 1 zcat $CWD/netpbm-noppmtompeg.patch.gz | patch -p1 --verbose || exit 1 -zcat $CWD/netpbm-pnmtops.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-CVE-2017-2587.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-python3.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-time.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-gcc4.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-bmptopnm.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-CAN-2005-2471.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-xwdfix.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-multilib.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-glibc.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-docfix.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-fiasco-overflow.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-cmuwtopbm.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-pamtojpeg2k.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-manfix.patch.gz | patch -p1 --verbose || exit 1 +zcat $CWD/netpbm-manual-pages.patch.gz | patch -p1 --verbose || exit 1 + +# Send blank lines to "configure" to just take defaults: +./configure << EOF + + + + + + + + + + + + + + + + + + + +EOF # Make sure ownerships and permissions are sane: chown -R root:root . @@ -79,16 +121,8 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; -# Configure: -if [ "$ARCH" = "x86_64" ]; then - zcat $CWD/config.mk.gz \ - | sed -e '/^CFLAGS/s/^CFLAGS = .*/& -fPIC/' > config.mk -else - zcat $CWD/config.mk.gz > config.mk -fi - -# Build and install (does not like parallel build): -make || exit 1 +# Build and install: +make $NUMJOBS || make || exit 1 make package pkgdir=$PKG || exit 1 # Strip binaries: @@ -99,7 +133,7 @@ find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ ( cd $PKG rm README mkdir -p usr - mv * usr + mv * usr 2> /dev/null cd usr mkdir -p doc/netpbm-$VERSION mv VERSION bin/doc.url doc/netpbm-$VERSION @@ -110,16 +144,33 @@ find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ echo "Please edit the correct library major version into the build script" exit 1 fi - mv lib lib${LIBDIRSUFFIX} + mv lib lib${LIBDIRSUFFIX} 2> /dev/null # Remove junk directories: rm -rf link misc # Remove manweb related files: - rm -rf bin/manweb man/man1/manweb.1* man/web + rm -rf bin/manweb man/web # Any other files in /usr are junk: rm --verbose * 2> /dev/null ) -# Compress and link manpages, if any: +# Create and install man pages for existing utilities: +( cd userguide + for i in *.html ; do + ../buildtools/makeman ${i} + done + for manpage in *.1 ; do + if [ ! -r $PKG/usr/bin/$(basename $manpage .1) ]; then + rm $manpage + fi + done + for i in 1 3 5 ; do + mkdir -p man/man${i} + mv *.${i} man/man${i} + done + mv man $PKG/usr +) + +# Compress and link manpages: if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man for manpagedir in $(find . -type d -name "man*") ; do @@ -134,16 +185,12 @@ if [ -d $PKG/usr/man ]; then ) fi -# Even out-of-date manpages are better than nothing. IMHO. -( cd $PKG/usr - tar xjf $CWD/netpbm-manpages.tar.bz2 -) - # Add a documentation directory: ( cd doc cp -a \ - COPYRIGHT.PATENT GPL_LICENSE.txt INSTALL Netpbm.programming \ - README* USERDOC copyright_summary lgpl_v21.txt \ + CONTRIBUTORS COPYRIGHT.PATENT GPL_LICENSE.txt HISTORY INSTALL \ + Netpbm.programming USERDOC copyright_summary lgpl_v21.txt \ + patent_summary \ $PKG/usr/doc/${PKGNAM}-$VERSION if [ -r HISTORY ]; then DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION) diff --git a/source/l/netpbm/slack-desc b/source/l/netpbm/slack-desc index c72599670..8d25d02cd 100644 --- a/source/l/netpbm/slack-desc +++ b/source/l/netpbm/slack-desc @@ -11,7 +11,7 @@ netpbm: netpbm: The netpbm package contains a library and tools for converting between netpbm: many different graphics formats. netpbm: -netpbm: +netpbm: Homepage: http://netpbm.sourceforge.net netpbm: netpbm: netpbm: diff --git a/source/l/netpbm/svn-checkout-stable.sh b/source/l/netpbm/svn-checkout-stable.sh deleted file mode 100755 index 2b2feb21c..000000000 --- a/source/l/netpbm/svn-checkout-stable.sh +++ /dev/null @@ -1 +0,0 @@ -svn checkout https://netpbm.svn.sourceforge.net/svnroot/netpbm/stable netpbm diff --git a/source/l/netpbm/svn-checkout.sh b/source/l/netpbm/svn-checkout.sh new file mode 100755 index 000000000..89cb8ae27 --- /dev/null +++ b/source/l/netpbm/svn-checkout.sh @@ -0,0 +1,23 @@ +# Clear the download area: +rm -rf netpbm + +# Stable (aka obsolete) version: +#svn checkout http://svn.code.sf.net/p/netpbm/code/stable netpbm + +# Advanced version: +svn checkout https://svn.code.sf.net/p/netpbm/code/advanced netpbm +svn checkout https://svn.code.sf.net/p/netpbm/code/userguide netpbm/userguide +( cd netpbm && find -name "\.svn" -type d -print0 | xargs -0 rm -rf ) +# Dropped due to patent issues: +rm -rf netpbm/converter/ppm/ppmtompeg/ + +# Tar it up: +eval $(cat netpbm/version.mk | tr -d ' ') +NETPBM_MAJOR_RELEASE=$(printf "%02d" $NETPBM_MAJOR_RELEASE) +NETPBM_MINOR_RELEASE=$(printf "%02d" $NETPBM_MINOR_RELEASE) +NETPBM_POINT_RELEASE=$(printf "%02d" $NETPBM_POINT_RELEASE) +rm -rf netpbm-${NETPBM_MAJOR_RELEASE}.${NETPBM_MINOR_RELEASE}.${NETPBM_POINT_RELEASE} netpbm-${NETPBM_MAJOR_RELEASE}.${NETPBM_MINOR_RELEASE}.${NETPBM_POINT_RELEASE}.tar netpbm-${NETPBM_MAJOR_RELEASE}.${NETPBM_MINOR_RELEASE}.${NETPBM_POINT_RELEASE}.tar.lz +mv netpbm netpbm-${NETPBM_MAJOR_RELEASE}.${NETPBM_MINOR_RELEASE}.${NETPBM_POINT_RELEASE} +tar cf netpbm-${NETPBM_MAJOR_RELEASE}.${NETPBM_MINOR_RELEASE}.${NETPBM_POINT_RELEASE}.tar netpbm-${NETPBM_MAJOR_RELEASE}.${NETPBM_MINOR_RELEASE}.${NETPBM_POINT_RELEASE} +plzip -9 netpbm-${NETPBM_MAJOR_RELEASE}.${NETPBM_MINOR_RELEASE}.${NETPBM_POINT_RELEASE}.tar +rm -r netpbm-${NETPBM_MAJOR_RELEASE}.${NETPBM_MINOR_RELEASE}.${NETPBM_POINT_RELEASE} |