From b5b7b21e1511b70f07ac93b6f87d2a835e99164d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 21 Apr 2013 10:14:58 +0200 Subject: gd: import from rawhide --- Makefile | 4 + gd-2.0.33-BoxBound.patch | 22 + gd-2.0.33-freetype.patch | 13 + gd-2.0.34-fonts.patch | 11 + gd-2.0.34-multilib.patch | 113 +++ gd-2.0.34-sparc64.patch | 13 + gd-2.0.35-AALineThick.patch | 66 ++ gd-2.0.35-overflow.patch | 13 + gd-2.0.35-runtests.patch | 23 + gd-2.0.35-security3.patch | 12 + gd-2.0.35-time.patch | 12 + gd-aarch64.patch | 1755 +++++++++++++++++++++++++++++++++++++++++++ gd-gdcalloc.patch | 25 + gd-loop.patch | 24 + gd-sa1.patch | 59 ++ gd-sa2.patch | 515 +++++++++++++ gd-sa3.patch | 31 + gd-sa4.patch | 148 ++++ gd.spec | 400 ++++++++++ 19 files changed, 3259 insertions(+) create mode 100644 Makefile create mode 100644 gd-2.0.33-BoxBound.patch create mode 100644 gd-2.0.33-freetype.patch create mode 100644 gd-2.0.34-fonts.patch create mode 100644 gd-2.0.34-multilib.patch create mode 100644 gd-2.0.34-sparc64.patch create mode 100644 gd-2.0.35-AALineThick.patch create mode 100644 gd-2.0.35-overflow.patch create mode 100644 gd-2.0.35-runtests.patch create mode 100644 gd-2.0.35-security3.patch create mode 100644 gd-2.0.35-time.patch create mode 100644 gd-aarch64.patch create mode 100644 gd-gdcalloc.patch create mode 100644 gd-loop.patch create mode 100644 gd-sa1.patch create mode 100644 gd-sa2.patch create mode 100644 gd-sa3.patch create mode 100644 gd-sa4.patch create mode 100644 gd.spec diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1e65467 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../common/Makefile + diff --git a/gd-2.0.33-BoxBound.patch b/gd-2.0.33-BoxBound.patch new file mode 100644 index 0000000..c5daf36 --- /dev/null +++ b/gd-2.0.33-BoxBound.patch @@ -0,0 +1,22 @@ +--- gd-2.0.33/gdft.c.pom 2004-11-02 22:00:48.000000000 +0100 ++++ gd-2.0.33/gdft.c 2006-11-21 09:25:49.000000000 +0100 +@@ -1237,7 +1237,8 @@ + glyph_min.x = penf.x + slot->metrics.horiBearingX; + glyph_min.y = penf.y - slot->metrics.horiBearingY; + +-#if 0 ++// #if 0 - this version of glyph_max.x setting fixes problem with ++// too large bouonding box + if (ch == ' ') /* special case for trailing space */ + { + glyph_max.x = penf.x + horiAdvance; +@@ -1246,7 +1247,8 @@ + { + glyph_max.x = glyph_min.x + slot->metrics.width; + } +-#else ++//#else ++#if 0 + glyph_max.x = penf.x + horiAdvance; + #endif + glyph_max.y = glyph_min.y + slot->metrics.height; diff --git a/gd-2.0.33-freetype.patch b/gd-2.0.33-freetype.patch new file mode 100644 index 0000000..3813994 --- /dev/null +++ b/gd-2.0.33-freetype.patch @@ -0,0 +1,13 @@ +--- gd-2.0.33/configure.freetype 2005-09-07 17:16:03.000000000 +0200 ++++ gd-2.0.33/configure 2005-09-07 17:16:54.000000000 +0200 +@@ -11705,8 +11705,8 @@ + else + libft_INCLUDES=`$FREETYPE_CONFIG --cflags` + fi +- libft_LDFLAGS=`$FREETYPE_CONFIG --libs` +- libft_LDFLAGS=`echo " $libft_LDFLAGS" |sed 's/(^| )-l[^ ][^ ]*//g'` ++ # Hack to ingore the broken freetype config --libs flags ++ libft_LDFLAGS="" + else + if test -n "$FREETYPE_DIR"; then + libft_INCLUDES="-I$FREETYPE_DIR/include/freetype2 -I$FREETYPE_DIR/include" diff --git a/gd-2.0.34-fonts.patch b/gd-2.0.34-fonts.patch new file mode 100644 index 0000000..acb119b --- /dev/null +++ b/gd-2.0.34-fonts.patch @@ -0,0 +1,11 @@ +--- gd-2.0.34/Makefile.in.pom 2007-09-04 15:08:18.000000000 +0200 ++++ gd-2.0.34/Makefile.in 2007-09-04 15:58:05.000000000 +0200 +@@ -227,7 +227,7 @@ AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ +-CFLAGS = @CFLAGS@ ++CFLAGS = @CFLAGS@ -D_DEFAULT_FONTPATH="/usr/share/X11/fonts/TTF/:/usr/share/fonts/bitstream-vera/:/usr/share/fonts/dejavu-lgc/:/usr/share/fonts/default/Type1/:/usr/share/X11/fonts/Type1:/usr/share/fonts/liberation/" + CPP = @CPP@ + CPPFLAGS = @CPPFLAGS@ + CXX = @CXX@ diff --git a/gd-2.0.34-multilib.patch b/gd-2.0.34-multilib.patch new file mode 100644 index 0000000..a2c9e89 --- /dev/null +++ b/gd-2.0.34-multilib.patch @@ -0,0 +1,113 @@ +--- /dev/null 2007-09-04 12:46:47.564263777 +0200 ++++ gd-2.0.34/config/gdlib.pc.in 2007-09-04 15:17:09.000000000 +0200 +@@ -0,0 +1,15 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++bindir=@bindir@ ++ldflags=@LDFLAGS@ ++ ++ ++Name: gd-devel ++Description: A graphics library for quick creation of PNG or JPEG images ++Version: @VERSION@ ++Requires: ++Libs: -L${libdir} -lgd ++Libs.private: @LIBS@ ++Cflags: -I${includedir} +--- gd-2.0.34/Makefile.in.pom 2007-02-03 02:41:46.000000000 +0100 ++++ gd-2.0.34/Makefile.in 2007-02-08 13:34:06.000000000 +0100 +@@ -341,6 +341,7 @@ + ACLOCAL_AMFLAGS = -I config + SUBDIRS = config test + bin_SCRIPTS = bdftogd config/gdlib-config ++pkgconf_CFILE = config/gdlib.pc + EXTRA_DIST = README-JPEG.TXT README.TXT configure.pl bdftogd demoin.png err.out index.html install-item makefile.sample readme.jpn entities.html entities.tcl + include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h entities.h + lib_LTLIBRARIES = libgd.la +@@ -553,6 +554,15 @@ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + ++install-pkgconfigCF: ++ $(mkdir_p) "$(DESTDIR)$(libdir)/pkgconfig" ++ echo " cp $(pkgconf_CFILE) $(DESTDIR)$(libdir)/pkgconfig/gdlib.pc" ++ cp $(pkgconf_CFILE) $(DESTDIR)$(libdir)/pkgconfig/gdlib.pc ++ ++uninstall-pkgconfigCF: ++ echo " rm $(DESTDIR)$(libdir)/pkgconfig/gdlib.pc" ++ rm $(DESTDIR)$(libdir)/pkgconfig/gdlib.pc ++ + mostlyclean-compile: + -rm -f *.$(OBJEXT) + +@@ -986,7 +996,7 @@ + + install-data-am: install-includeHEADERS + +-install-exec-am: install-binPROGRAMS install-binSCRIPTS \ ++install-exec-am: install-binPROGRAMS install-binSCRIPTS install-pkgconfigCF\ + install-libLTLIBRARIES + + install-info: install-info-recursive +@@ -1015,7 +1025,7 @@ + + ps-am: + +-uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ ++uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-pkgconfigCF\ + uninstall-includeHEADERS uninstall-info-am \ + uninstall-libLTLIBRARIES + +--- gd-2.0.34/config/gdlib-config.in.pom 2007-02-03 02:41:00.000000000 +0100 ++++ gd-2.0.34/config/gdlib-config.in 2007-02-08 13:27:25.000000000 +0100 +@@ -7,9 +7,10 @@ + # installation directories + prefix=@prefix@ + exec_prefix=@exec_prefix@ +-libdir=@libdir@ ++libdir=`pkg-config gdlib --variable=libdir` + includedir=@includedir@ + bindir=@bindir@ ++ldflags=`pkg-config gdlib --variable=ldflags` + + usage() + { +@@ -68,7 +69,7 @@ + echo @GDLIB_REVISION@ + ;; + --ldflags) +- echo @LDFLAGS@ ++ echo $ldflags + ;; + --libs) + echo @LIBS@ @LIBICONV@ +@@ -83,7 +84,7 @@ + echo "GD library @VERSION@" + echo "includedir: $includedir" + echo "cflags: -I@includedir@" +- echo "ldflags: @LDFLAGS@" ++ echo "ldflags: $ldflags" + echo "libs: @LIBS@ @LIBICONV@" + echo "libdir: $libdir" + echo "features: @FEATURES@" +--- gd-2.0.34/configure.pom 2007-02-08 13:25:00.000000000 +0100 ++++ gd-2.0.34/configure 2007-02-08 13:31:53.000000000 +0100 +@@ -24672,7 +24672,7 @@ + Support for pthreads: $acx_pthread_ok + " >&6; } + +-ac_config_files="$ac_config_files Makefile config/Makefile config/gdlib-config test/Makefile" ++ac_config_files="$ac_config_files Makefile config/Makefile config/gdlib-config config/gdlib.pc test/Makefile" + + + cat >confcache <<\_ACEOF +@@ -25257,6 +25257,7 @@ + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "config/Makefile") CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; + "config/gdlib-config") CONFIG_FILES="$CONFIG_FILES config/gdlib-config" ;; ++ "config/gdlib.pc" ) CONFIG_FILES="$CONFIG_FILES config/gdlib.pc" ;; + "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 diff --git a/gd-2.0.34-sparc64.patch b/gd-2.0.34-sparc64.patch new file mode 100644 index 0000000..d82a383 --- /dev/null +++ b/gd-2.0.34-sparc64.patch @@ -0,0 +1,13 @@ +--- gd-2.0.34/configure.sp 2007-02-08 13:44:32.000000000 +0100 ++++ gd-2.0.34/configure 2007-02-08 13:50:39.000000000 +0100 +@@ -9075,8 +9075,8 @@ + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then +- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_cmds='$CC $CFLAGS -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' ++ archive_expsym_cmds='$CC $CFLAGS -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi diff --git a/gd-2.0.35-AALineThick.patch b/gd-2.0.35-AALineThick.patch new file mode 100644 index 0000000..4349ada --- /dev/null +++ b/gd-2.0.35-AALineThick.patch @@ -0,0 +1,66 @@ +diff -up gd-2.0.35/gd.c.AALineThick gd-2.0.35/gd.c +--- gd-2.0.35/gd.c.AALineThick 2007-06-19 22:25:51.000000000 +0200 ++++ gd-2.0.35/gd.c 2012-02-28 11:02:09.708015922 +0100 +@@ -3474,6 +3474,8 @@ static void gdImageAALine (gdImagePtr im + /* keep them as 32bits */ + long x, y, inc; + long dx, dy,tmp; ++ int w, wid, wstart; ++ int thick = im->thick; + + if (!im->trueColor) { + /* TBB: don't crash when the image is of the wrong type */ +@@ -3502,6 +3504,25 @@ static void gdImageAALine (gdImagePtr im + gdImageSetAAPixelColor(im, x1, y1, col, 0xFF); + return; + } ++ else { ++ double ag; ++ if (abs(dy) < abs(dx)) ++ ag = cos (atan2 (dy, dx)); ++ else ++ ag = sin (atan2 (dy, dx)); ++ if (ag != 0) ++ { ++ wid = abs(thick / ag); ++ } ++ else ++ { ++ wid = 1; ++ } ++ if (wid == 0) ++ { ++ wid = 1; ++ } ++ } + if (abs(dx) > abs(dy)) { + if (dx < 0) { + tmp = x1; +@@ -3518,8 +3539,11 @@ static void gdImageAALine (gdImagePtr im + inc = (dy * 65536) / dx; + /* TBB: set the last pixel for consistency (<=) */ + while ((x >> 16) <= x2) { +- gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF); +- gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF); ++ wstart = (y >> 16) - wid / 2; ++ for (w = wstart; w < wstart + wid; w++) { ++ gdImageSetAAPixelColor(im, (x >> 16) , w , col , (y >> 8) & 0xFF); ++ gdImageSetAAPixelColor(im, (x >> 16) , w + 1 , col, (~y >> 8) & 0xFF); ++ } + x += (1 << 16); + y += inc; + } +@@ -3539,8 +3563,11 @@ static void gdImageAALine (gdImagePtr im + inc = (dx * 65536) / dy; + /* TBB: set the last pixel for consistency (<=) */ + while ((y>>16) <= y2) { +- gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF); +- gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF); ++ wstart = (x >> 16) - wid / 2; ++ for (w = wstart; w < wstart + wid; w++) { ++ gdImageSetAAPixelColor(im, w , y >> 16 , col, (x >> 8) & 0xFF); ++ gdImageSetAAPixelColor(im, w + 1, y >> 16, col, (~x >> 8) & 0xFF); ++ } + x += inc; + y += (1<<16); + } diff --git a/gd-2.0.35-overflow.patch b/gd-2.0.35-overflow.patch new file mode 100644 index 0000000..f71c953 --- /dev/null +++ b/gd-2.0.35-overflow.patch @@ -0,0 +1,13 @@ +--- gd-2.0.35/gd_gd.c.pom 2006-04-05 17:52:22.000000000 +0200 ++++ gd-2.0.35/gd_gd.c 2007-09-05 11:31:39.000000000 +0200 +@@ -149,6 +149,10 @@ _gdCreateFromFile (gdIOCtx * in, int *sx + { + im = gdImageCreate (*sx, *sy); + } ++ if (!im) ++ { ++ goto fail1; ++ } + if (!_gdGetColors (in, im, gd2xFlag)) + { + goto fail2; diff --git a/gd-2.0.35-runtests.patch b/gd-2.0.35-runtests.patch new file mode 100644 index 0000000..9583dd3 --- /dev/null +++ b/gd-2.0.35-runtests.patch @@ -0,0 +1,23 @@ +diff -up gd-2.0.35/tests/CMakeLists.txt.tests gd-2.0.35/tests/CMakeLists.txt +--- gd-2.0.35/tests/CMakeLists.txt.tests 2012-08-28 10:49:51.172059567 +0200 ++++ gd-2.0.35/tests/CMakeLists.txt 2012-08-28 10:49:43.251931396 +0200 +@@ -23,8 +23,8 @@ if (BUILD_TEST) + include_directories (BEFORE ${GD_INCLUDE_DIR} "${GDTEST_SOURCE_DIR}") + link_directories ("${GD_LIBS_DIR}" "${GDTEST_BINARY_DIR}/gdtest") + +- #FIND_LIBRARY(GD_LIB "gd" PATHS ${GD_LIBS_DIR}) +- #message(STATUS "GD_LIB: ${GD_LIB}") ++ FIND_LIBRARY(GD_LIB "gd" PATHS ${GD_LIBS_DIR}) ++ message(STATUS "GD_LIB: ${GD_LIB}") + + SET(TESTS_DIRS + gdtest +@@ -33,7 +33,7 @@ if (BUILD_TEST) + gdimagecolorexact + gdimagecolorresolve + #gdimageellipse +- gdimageline ++ #gdimageline + gdimagefilledellipse + gdimagecopyrotated + gdtiled diff --git a/gd-2.0.35-security3.patch b/gd-2.0.35-security3.patch new file mode 100644 index 0000000..e15587b --- /dev/null +++ b/gd-2.0.35-security3.patch @@ -0,0 +1,12 @@ +--- gd-2.0.28/gd_gd.c 2004-05-24 17:28:12.000000000 +0200 ++++ gd-2.0.28_new/gd_gd.c 2009-12-08 15:19:16.159836680 +0100 +@@ -44,6 +44,9 @@ + { + goto fail1; + } ++ if (im->colorsTotal > gdMaxColors) { ++ goto fail1; ++ } + } + /* Int to accommodate truecolor single-color transparency */ + if (!gdGetInt (&im->transparent, in)) diff --git a/gd-2.0.35-time.patch b/gd-2.0.35-time.patch new file mode 100644 index 0000000..c645698 --- /dev/null +++ b/gd-2.0.35-time.patch @@ -0,0 +1,12 @@ +diff -up gd-2.0.35/Makefile.in.time gd-2.0.35/Makefile.in +--- gd-2.0.35/Makefile.in.time 2009-01-06 15:07:36.000000000 +0100 ++++ gd-2.0.35/Makefile.in 2009-01-06 15:09:54.000000000 +0100 +@@ -25,7 +25,7 @@ pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = . + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +-INSTALL = @INSTALL@ ++INSTALL = @INSTALL@ -p + install_sh_DATA = $(install_sh) -c -m 644 + install_sh_PROGRAM = $(install_sh) -c + install_sh_SCRIPT = $(install_sh) -c diff --git a/gd-aarch64.patch b/gd-aarch64.patch new file mode 100644 index 0000000..92ff4f9 --- /dev/null +++ b/gd-aarch64.patch @@ -0,0 +1,1755 @@ +diff -urN gd-2.0.35/config/config.guess gd-2.0.35-aarch64/config/config.guess +--- gd-2.0.35/config/config.guess 2006-10-09 09:22:22.000000000 -0500 ++++ gd-2.0.35-aarch64/config/config.guess 2013-03-07 23:22:53.605495889 -0600 +@@ -1,10 +1,10 @@ + #! /bin/sh + # Attempt to guess a canonical system name. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +-# Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, ++# 2011, 2012 Free Software Foundation, Inc. + +-timestamp='2006-07-02' ++timestamp='2012-09-25' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by +@@ -17,9 +17,7 @@ + # General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +-# 02110-1301, USA. ++# along with this program; if not, see . + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a +@@ -27,16 +25,16 @@ + # the same distribution terms that you use for the rest of that program. + + +-# Originally written by Per Bothner . +-# Please send patches to . Submit a context +-# diff and a properly formatted ChangeLog entry. ++# Originally written by Per Bothner. Please send patches (context ++# diff format) to and include a ChangeLog ++# entry. + # + # This script attempts to guess a canonical system name similar to + # config.sub. If it succeeds, it prints the system name on stdout, and + # exits with 0. Otherwise, it exits with 1. + # +-# The plan is that this can be called by configure scripts if you +-# don't specify an explicit build system type. ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + + me=`echo "$0" | sed -e 's,.*/,,'` + +@@ -56,7 +54,8 @@ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 + Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO +@@ -139,29 +138,12 @@ + UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown + UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +-if [ "${UNAME_SYSTEM}" = "Linux" ] ; then +- eval $set_cc_for_build +- cat << EOF > $dummy.c +- #include +- #ifdef __UCLIBC__ +- # ifdef __UCLIBC_CONFIG_VERSION__ +- LIBC=uclibc __UCLIBC_CONFIG_VERSION__ +- # else +- LIBC=uclibc +- # endif +- #else +- LIBC=gnu +- #endif +-EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'` +-fi +- + # Note: order is significant - the case branches are not exclusive. + + case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or +- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, ++ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward +@@ -178,6 +160,7 @@ + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; ++ sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched +@@ -186,7 +169,7 @@ + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ +- | grep __ELF__ >/dev/null ++ | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? +@@ -196,7 +179,7 @@ + fi + ;; + *) +- os=netbsd ++ os=netbsd + ;; + esac + # The OS release +@@ -217,6 +200,10 @@ + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; ++ *:Bitrig:*:*) ++ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` ++ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} ++ exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} +@@ -239,7 +226,7 @@ + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) +- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on +@@ -285,7 +272,10 @@ + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- exit ;; ++ # Reset EXIT trap before exiting to avoid spurious non-zero exit code. ++ exitcode=$? ++ trap '' 0 ++ exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead +@@ -311,12 +301,12 @@ + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) +- echo powerpc-ibm-os400 ++ echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; +- arm:riscos:*:*|arm:RISCOS:*:*) ++ arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) +@@ -340,14 +330,33 @@ + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; ++ s390x:SunOS:*:*) ++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; +- i86pc:SunOS:5.*:*) +- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) ++ echo i386-pc-auroraux${UNAME_RELEASE} ++ exit ;; ++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) ++ eval $set_cc_for_build ++ SUN_ARCH="i386" ++ # If there is a compiler, see if it is configured for 64-bit objects. ++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. ++ # This test works for both compilers. ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ SUN_ARCH="x86_64" ++ fi ++ fi ++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize +@@ -391,23 +400,23 @@ + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit ;; ++ exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) +- echo m68k-milan-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-milan-mint${UNAME_RELEASE} ++ exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) +- echo m68k-hades-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-hades-mint${UNAME_RELEASE} ++ exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) +- echo m68k-unknown-mint${UNAME_RELEASE} +- exit ;; ++ echo m68k-unknown-mint${UNAME_RELEASE} ++ exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; +@@ -477,8 +486,8 @@ + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) +- # DG/UX returns AViiON for all architectures +- UNAME_PROCESSOR=`/usr/bin/uname -p` ++ # DG/UX returns AViiON for all architectures ++ UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ +@@ -491,7 +500,7 @@ + else + echo i586-dg-dgux${UNAME_RELEASE} + fi +- exit ;; ++ exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; +@@ -548,7 +557,7 @@ + echo rs6000-ibm-aix3.2 + fi + exit ;; +- *:AIX:*:[45]) ++ *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 +@@ -591,52 +600,52 @@ + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` +- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` +- case "${sc_cpu_version}" in +- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 +- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 +- 532) # CPU_PA_RISC2_0 +- case "${sc_kernel_bits}" in +- 32) HP_ARCH="hppa2.0n" ;; +- 64) HP_ARCH="hppa2.0w" ;; ++ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` ++ case "${sc_cpu_version}" in ++ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 ++ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 ++ 532) # CPU_PA_RISC2_0 ++ case "${sc_kernel_bits}" in ++ 32) HP_ARCH="hppa2.0n" ;; ++ 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 +- esac ;; +- esac ++ esac ;; ++ esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ sed 's/^ //' << EOF >$dummy.c ++ ++ #define _HPUX_SOURCE ++ #include ++ #include + +- #define _HPUX_SOURCE +- #include +- #include +- +- int main () +- { +- #if defined(_SC_KERNEL_BITS) +- long bits = sysconf(_SC_KERNEL_BITS); +- #endif +- long cpu = sysconf (_SC_CPU_VERSION); +- +- switch (cpu) +- { +- case CPU_PA_RISC1_0: puts ("hppa1.0"); break; +- case CPU_PA_RISC1_1: puts ("hppa1.1"); break; +- case CPU_PA_RISC2_0: +- #if defined(_SC_KERNEL_BITS) +- switch (bits) +- { +- case 64: puts ("hppa2.0w"); break; +- case 32: puts ("hppa2.0n"); break; +- default: puts ("hppa2.0"); break; +- } break; +- #else /* !defined(_SC_KERNEL_BITS) */ +- puts ("hppa2.0"); break; +- #endif +- default: puts ("hppa1.0"); break; +- } +- exit (0); +- } ++ int main () ++ { ++ #if defined(_SC_KERNEL_BITS) ++ long bits = sysconf(_SC_KERNEL_BITS); ++ #endif ++ long cpu = sysconf (_SC_CPU_VERSION); ++ ++ switch (cpu) ++ { ++ case CPU_PA_RISC1_0: puts ("hppa1.0"); break; ++ case CPU_PA_RISC1_1: puts ("hppa1.1"); break; ++ case CPU_PA_RISC2_0: ++ #if defined(_SC_KERNEL_BITS) ++ switch (bits) ++ { ++ case 64: puts ("hppa2.0w"); break; ++ case 32: puts ("hppa2.0n"); break; ++ default: puts ("hppa2.0"); break; ++ } break; ++ #else /* !defined(_SC_KERNEL_BITS) */ ++ puts ("hppa2.0"); break; ++ #endif ++ default: puts ("hppa1.0"); break; ++ } ++ exit (0); ++ } + EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa +@@ -656,7 +665,7 @@ + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | +- grep __LP64__ >/dev/null ++ grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else +@@ -727,22 +736,22 @@ + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd +- exit ;; ++ exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi +- exit ;; ++ exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd +- exit ;; ++ exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd +- exit ;; ++ exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd +- exit ;; ++ exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; +@@ -766,14 +775,14 @@ + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` +- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" +- exit ;; ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` ++ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ exit ;; + 5000:UNIX_System_V:4.*:*) +- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` +- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` ++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} +@@ -785,37 +794,51 @@ + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) +- case ${UNAME_MACHINE} in +- pc98) +- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ UNAME_PROCESSOR=`/usr/bin/uname -p` ++ case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) +- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; +- i*:MINGW*:*) ++ *:MINGW64*:*) ++ echo ${UNAME_MACHINE}-pc-mingw64 ++ exit ;; ++ *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; ++ i*:MSYS*:*) ++ echo ${UNAME_MACHINE}-pc-msys ++ exit ;; + i*:windows32*:*) +- # uname -m includes "-pc" on this system. +- echo ${UNAME_MACHINE}-mingw32 ++ # uname -m includes "-pc" on this system. ++ echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; +- x86:Interix*:[3456]*) +- echo i586-pc-interix${UNAME_RELEASE} +- exit ;; +- EM64T:Interix*:[3456]*) +- echo x86_64-unknown-interix${UNAME_RELEASE} +- exit ;; ++ *:Interix*:*) ++ case ${UNAME_MACHINE} in ++ x86) ++ echo i586-pc-interix${UNAME_RELEASE} ++ exit ;; ++ authenticamd | genuineintel | EM64T) ++ echo x86_64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ IA64) ++ echo ia64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; ++ 8664:Windows_NT:*) ++ echo x86_64-pc-mks ++ exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we +@@ -845,193 +868,144 @@ + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; ++ aarch64:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ aarch64_be:Linux:*:*) ++ UNAME_MACHINE=aarch64_be ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ alpha:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ EV5) UNAME_MACHINE=alphaev5 ;; ++ EV56) UNAME_MACHINE=alphaev56 ;; ++ PCA56) UNAME_MACHINE=alphapca56 ;; ++ PCA57) UNAME_MACHINE=alphapca56 ;; ++ EV6) UNAME_MACHINE=alphaev6 ;; ++ EV67) UNAME_MACHINE=alphaev67 ;; ++ EV68*) UNAME_MACHINE=alphaev68 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi ++ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ++ exit ;; + arm*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ eval $set_cc_for_build ++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_EABI__ ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ else ++ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_PCS_VFP ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi ++ else ++ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf ++ fi ++ fi + exit ;; + avr32*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) +- echo cris-axis-linux-${LIBC} ++ echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) +- echo crisv32-axis-linux-${LIBC} ++ echo ${UNAME_MACHINE}-axis-linux-gnu + exit ;; + frv:Linux:*:*) +- echo frv-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ hexagon:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ i*86:Linux:*:*) ++ LIBC=gnu ++ eval $set_cc_for_build ++ sed 's/^ //' << EOF >$dummy.c ++ #ifdef __dietlibc__ ++ LIBC=dietlibc ++ #endif ++EOF ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ++ echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; +- mips:Linux:*:*) +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #undef CPU +- #undef mips +- #undef mipsel +- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mipsel +- #else +- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips +- #else +- CPU= +- #endif +- #endif +-EOF +- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' +- /^CPU/{ +- s: ::g +- p +- }'`" +- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } +- ;; +- mips64:Linux:*:*) ++ mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU +- #undef mips64 +- #undef mips64el ++ #undef ${UNAME_MACHINE} ++ #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mips64el ++ CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips64 ++ CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif + EOF +- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' +- /^CPU/{ +- s: ::g +- p +- }'`" +- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` ++ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) +- echo or32-unknown-linux-${LIBC} +- exit ;; +- ppc:Linux:*:*) +- echo powerpc-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; +- ppc64:Linux:*:*) +- echo powerpc64-unknown-linux-${LIBC} ++ padre:Linux:*:*) ++ echo sparc-unknown-linux-gnu + exit ;; +- alpha:Linux:*:*) +- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in +- EV5) UNAME_MACHINE=alphaev5 ;; +- EV56) UNAME_MACHINE=alphaev56 ;; +- PCA56) UNAME_MACHINE=alphapca56 ;; +- PCA57) UNAME_MACHINE=alphapca56 ;; +- EV6) UNAME_MACHINE=alphaev6 ;; +- EV67) UNAME_MACHINE=alphaev67 ;; +- EV68*) UNAME_MACHINE=alphaev68 ;; +- esac +- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null +- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ parisc64:Linux:*:* | hppa64:Linux:*:*) ++ echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in +- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; +- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; +- *) echo hppa-unknown-linux-${LIBC} ;; ++ PA7*) echo hppa1.1-unknown-linux-gnu ;; ++ PA8*) echo hppa2.0-unknown-linux-gnu ;; ++ *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; +- parisc64:Linux:*:* | hppa64:Linux:*:*) +- echo hppa64-unknown-linux-${LIBC} ++ ppc64:Linux:*:*) ++ echo powerpc64-unknown-linux-gnu ++ exit ;; ++ ppc:Linux:*:*) ++ echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ tile*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) +- echo ${UNAME_MACHINE}-dec-linux-${LIBC} ++ echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) +- echo x86_64-unknown-linux-${LIBC} ++ echo ${UNAME_MACHINE}-unknown-linux-gnu ++ exit ;; ++ xtensa*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; +- i*86:Linux:*:*) +- # The BFD linker knows what the default object file format is, so +- # first see if it will tell us. cd to the root directory to prevent +- # problems with other programs or directories called `ld' in the path. +- # Set LC_ALL=C to ensure ld outputs messages in English. +- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ +- | sed -ne '/supported targets:/!d +- s/[ ][ ]*/ /g +- s/.*supported targets: *// +- s/ .*// +- p'` +- case "$ld_supported_targets" in +- elf32-i386) +- TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}" +- ;; +- a.out-i386-linux) +- echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout" +- exit ;; +- coff-i386) +- echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff" +- exit ;; +- "") +- # Either a pre-BFD a.out linker (linux-gnuoldld) or +- # one that does not give us useful --help. +- echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld" +- exit ;; +- esac +- # This should get integrated into the C code below, but now we hack +- if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi +- # Determine whether the default compiler is a.out or elf +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #include +- #ifdef __ELF__ +- # ifdef __GLIBC__ +- # if __GLIBC__ >= 2 +- LIBC=gnu +- # else +- LIBC=gnulibc1 +- # endif +- # else +- LIBC=gnulibc1 +- # endif +- #else +- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) +- LIBC=gnu +- #else +- LIBC=gnuaout +- #endif +- #endif +- #ifdef __dietlibc__ +- LIBC=dietlibc +- #endif +-EOF +- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' +- /^LIBC/{ +- s: ::g +- p +- }'`" +- test x"${LIBC}" != x && { +- echo "${UNAME_MACHINE}-pc-linux-${LIBC}" +- exit +- } +- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } +- ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both +@@ -1039,11 +1013,11 @@ + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) +- # Unixware is an offshoot of SVR4, but it has its own version +- # number series starting with 2... +- # I am not positive that other SVR4 systems won't match this, ++ # Unixware is an offshoot of SVR4, but it has its own version ++ # number series starting with 2... ++ # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. +- # Use sysv4.2uw... so that sysv4* matches it. ++ # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) +@@ -1060,7 +1034,7 @@ + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; +- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) ++ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) +@@ -1075,7 +1049,7 @@ + fi + exit ;; + i*86:*:5:[678]*) +- # UnixWare 7.x, OpenUNIX and OpenServer 6. ++ # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; +@@ -1103,10 +1077,13 @@ + exit ;; + pc:*:*:*) + # Left here for compatibility: +- # uname -m prints for DJGPP always 'pc', but it prints nothing about +- # the processor, so we play safe by assuming i386. +- echo i386-pc-msdosdjgpp +- exit ;; ++ # uname -m prints for DJGPP always 'pc', but it prints nothing about ++ # the processor, so we play safe by assuming i586. ++ # Note: whatever this is, it MUST be the same as what config.sub ++ # prints for the "djgpp" host, or else GDB configury will decide that ++ # this is a cross-build. ++ echo i586-pc-msdosdjgpp ++ exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; +@@ -1141,8 +1118,18 @@ + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) +- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && { echo i486-ncr-sysv4; exit; } ;; ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4; exit; } ;; ++ NCR*:*:4.2:* | MPRAS*:*:4.2:*) ++ OS_REL='.3' ++ test -r /etc/.relid \ ++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; +@@ -1155,7 +1142,7 @@ + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; +- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) ++ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) +@@ -1175,10 +1162,10 @@ + echo ns32k-sni-sysv + fi + exit ;; +- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort +- # says +- echo i586-unisys-sysv4 +- exit ;; ++ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort ++ # says ++ echo i586-unisys-sysv4 ++ exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm +@@ -1204,11 +1191,11 @@ + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then +- echo mips-nec-sysv${UNAME_RELEASE} ++ echo mips-nec-sysv${UNAME_RELEASE} + else +- echo mips-unknown-sysv${UNAME_RELEASE} ++ echo mips-unknown-sysv${UNAME_RELEASE} + fi +- exit ;; ++ exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; +@@ -1218,6 +1205,12 @@ + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; ++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. ++ echo i586-pc-haiku ++ exit ;; ++ x86_64:Haiku:*:*) ++ echo x86_64-unknown-haiku ++ exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; +@@ -1227,6 +1220,15 @@ + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; ++ SX-7:SUPER-UX:*:*) ++ echo sx7-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8:SUPER-UX:*:*) ++ echo sx8-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8R:SUPER-UX:*:*) ++ echo sx8r-nec-superux${UNAME_RELEASE} ++ exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; +@@ -1236,6 +1238,16 @@ + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in ++ i386) ++ eval $set_cc_for_build ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ UNAME_PROCESSOR="x86_64" ++ fi ++ fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} +@@ -1251,7 +1263,10 @@ + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; +- NSE-?:NONSTOP_KERNEL:*:*) ++ NEO-?:NONSTOP_KERNEL:*:*) ++ echo neo-tandem-nsk${UNAME_RELEASE} ++ exit ;; ++ NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) +@@ -1296,13 +1311,13 @@ + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) +- echo mips-sei-seiux${UNAME_RELEASE} ++ echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) +- UNAME_MACHINE=`(uname -p) 2>/dev/null` ++ UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; +@@ -1317,11 +1332,14 @@ + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; ++ i*86:AROS:*:*) ++ echo ${UNAME_MACHINE}-pc-aros ++ exit ;; ++ x86_64:VMkernel:*:*) ++ echo ${UNAME_MACHINE}-unknown-esx ++ exit ;; + esac + +-#echo '(No uname command or uname output not recognized.)' 1>&2 +-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +- + eval $set_cc_for_build + cat >$dummy.c < + printf ("m68k-sony-newsos%s\n", + #ifdef NEWSOS4 +- "4" ++ "4" + #else +- "" ++ "" + #endif +- ); exit (0); ++ ); exit (0); + #endif + #endif + +@@ -1477,9 +1495,9 @@ + the operating system you are using. It is advised that you + download the most up to date version of the config scripts from + +- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + and +- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + + If the version you run ($0) is already up to date, please + send the following data and any information you think might be +diff -urN gd-2.0.35/config/config.sub gd-2.0.35-aarch64/config/config.sub +--- gd-2.0.35/config/config.sub 2006-10-09 09:22:22.000000000 -0500 ++++ gd-2.0.35-aarch64/config/config.sub 2013-03-07 23:22:53.638492102 -0600 +@@ -1,10 +1,10 @@ + #! /bin/sh + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +-# Inc. ++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, ++# 2011, 2012 Free Software Foundation, Inc. + +-timestamp='2006-07-02' ++timestamp='2012-10-10' + + # This file is (in principle) common to ALL GNU software. + # The presence of a machine in this file suggests that SOME GNU software +@@ -21,9 +21,7 @@ + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +-# 02110-1301, USA. ++# along with this program; if not, see . + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a +@@ -32,13 +30,16 @@ + + + # Please send patches to . Submit a context +-# diff and a properly formatted ChangeLog entry. ++# diff and a properly formatted GNU ChangeLog entry. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. + # Otherwise, we print the canonical config type on stdout and succeed. + ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD ++ + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases + # that are meaningful with *any* GNU software. +@@ -72,7 +73,8 @@ + version="\ + GNU config.sub ($timestamp) + +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 ++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, ++2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 + Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO +@@ -120,12 +122,18 @@ + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ +- uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ ++ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ ++ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ ++ knetbsd*-gnu* | netbsd*-gnu* | \ ++ kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; ++ android-linux) ++ os=-linux-android ++ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ++ ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] +@@ -148,10 +156,13 @@ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis | -knuth | -cray) ++ -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; ++ -bluegene*) ++ os=-cnk ++ ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 +@@ -166,10 +177,10 @@ + os=-chorusos + basic_machine=$1 + ;; +- -chorusrdb) +- os=-chorusrdb ++ -chorusrdb) ++ os=-chorusrdb + basic_machine=$1 +- ;; ++ ;; + -hiux*) + os=-hiuxwe2 + ;; +@@ -214,6 +225,12 @@ + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; ++ -lynx*178) ++ os=-lynxos178 ++ ;; ++ -lynx*5) ++ os=-lynxos5 ++ ;; + -lynx*) + os=-lynxos + ;; +@@ -238,24 +255,32 @@ + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ ++ | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ ++ | be32 | be64 \ + | bfin \ + | c4x | clipper \ +- | d10v | d30v | dlx | dsp16xx | dvp \ +- | fr30 | frv \ ++ | d10v | d30v | dlx | dsp16xx \ ++ | epiphany \ ++ | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ ++ | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ ++ | le32 | le64 \ ++ | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ +- | maxq | mb | microblaze | mcore \ ++ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ +- | mips64vr | mips64vrel \ ++ | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ ++ | mips64r5900 | mips64r5900el \ ++ | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ +@@ -268,28 +293,42 @@ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ ++ | moxie \ + | mt \ + | msp430 \ ++ | nds32 | nds32le | nds32be \ + | nios | nios2 \ + | ns16k | ns32k \ ++ | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ +- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ ++ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ +- | sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ ++ | rl78 | rx \ ++ | score \ ++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ +- | spu | strongarm \ +- | tahoe | thumb | tic4x | tic80 | tron \ +- | v850 | v850e \ ++ | spu \ ++ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ ++ | ubicom32 \ ++ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ +- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ +- | z8k) ++ | x86 | xc16x | xstormy16 | xtensa \ ++ | z8k | z80) + basic_machine=$basic_machine-unknown + ;; +- m6811 | m68hc11 | m6812 | m68hc12) +- # Motorola 68HC11/12. ++ c54x) ++ basic_machine=tic54x-unknown ++ ;; ++ c55x) ++ basic_machine=tic55x-unknown ++ ;; ++ c6x) ++ basic_machine=tic6x-unknown ++ ;; ++ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; +@@ -299,6 +338,21 @@ + basic_machine=mt-unknown + ;; + ++ strongarm | thumb | xscale) ++ basic_machine=arm-unknown ++ ;; ++ xgate) ++ basic_machine=$basic_machine-unknown ++ os=-none ++ ;; ++ xscaleeb) ++ basic_machine=armeb-unknown ++ ;; ++ ++ xscaleel) ++ basic_machine=armel-unknown ++ ;; ++ + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. +@@ -313,29 +367,37 @@ + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ ++ | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ ++ | be32-* | be64-* \ + | bfin-* | bs2000-* \ +- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ ++ | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ +- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ ++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ ++ | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ ++ | le32-* | le64-* \ ++ | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | maxq-* | mcore-* \ ++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ ++ | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ +- | mips64vr-* | mips64vrel-* \ ++ | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ ++ | mips64r5900-* | mips64r5900el-* \ ++ | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ +@@ -350,27 +412,36 @@ + | mmix-* \ + | mt-* \ + | msp430-* \ ++ | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ ++ | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ +- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ ++ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ +- | romp-* | rs6000-* \ +- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ ++ | rl78-* | romp-* | rs6000-* | rx-* \ ++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ +- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ +- | tahoe-* | thumb-* \ ++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ ++ | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ ++ | tile*-* \ + | tron-* \ +- | v850-* | v850e-* | vax-* \ ++ | ubicom32-* \ ++ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ ++ | vax-* \ + | we32k-* \ +- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ +- | xstormy16-* | xtensa-* \ ++ | x86-* | x86_64-* | xc16x-* | xps100-* \ ++ | xstormy16-* | xtensa*-* \ + | ymp-* \ +- | z8k-*) ++ | z8k-* | z80-*) ++ ;; ++ # Recognize the basic CPU types without company name, with glob match. ++ xtensa*) ++ basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. +@@ -388,7 +459,7 @@ + basic_machine=a29k-amd + os=-udi + ;; +- abacus) ++ abacus) + basic_machine=abacus-unknown + ;; + adobe68k) +@@ -434,6 +505,10 @@ + basic_machine=m68k-apollo + os=-bsd + ;; ++ aros) ++ basic_machine=i386-pc ++ os=-aros ++ ;; + aux) + basic_machine=m68k-apple + os=-aux +@@ -442,10 +517,35 @@ + basic_machine=ns32k-sequent + os=-dynix + ;; ++ blackfin) ++ basic_machine=bfin-unknown ++ os=-linux ++ ;; ++ blackfin-*) ++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; ++ bluegene*) ++ basic_machine=powerpc-ibm ++ os=-cnk ++ ;; ++ c54x-*) ++ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ c55x-*) ++ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ c6x-*) ++ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; ++ cegcc) ++ basic_machine=arm-unknown ++ os=-cegcc ++ ;; + convex-c1) + basic_machine=c1-convex + os=-bsd +@@ -474,8 +574,8 @@ + basic_machine=craynv-cray + os=-unicosmp + ;; +- cr16c) +- basic_machine=cr16c-unknown ++ cr16 | cr16-*) ++ basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) +@@ -513,6 +613,10 @@ + basic_machine=m88k-motorola + os=-sysv3 + ;; ++ dicos) ++ basic_machine=i686-pc ++ os=-dicos ++ ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp +@@ -628,7 +732,6 @@ + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +-# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 +@@ -667,6 +770,14 @@ + basic_machine=m68k-isi + os=-sysv + ;; ++ m68knommu) ++ basic_machine=m68k-unknown ++ os=-linux ++ ;; ++ m68knommu-*) ++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + m88k-omron*) + basic_machine=m88k-omron + ;; +@@ -678,10 +789,21 @@ + basic_machine=ns32k-utek + os=-sysv + ;; ++ microblaze*) ++ basic_machine=microblaze-xilinx ++ ;; ++ mingw64) ++ basic_machine=x86_64-pc ++ os=-mingw64 ++ ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; ++ mingw32ce) ++ basic_machine=arm-unknown ++ os=-mingw32ce ++ ;; + miniframe) + basic_machine=m68000-convergent + ;; +@@ -689,24 +811,6 @@ + basic_machine=m68k-atari + os=-mint + ;; +- mipsEE* | ee | ps2) +- basic_machine=mips64r5900el-scei +- case $os in +- -linux*) +- ;; +- *) +- os=-elf +- ;; +- esac +- ;; +- iop) +- basic_machine=mipsel-scei +- os=-irx +- ;; +- dvp) +- basic_machine=dvp-scei +- os=-elf +- ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; +@@ -728,10 +832,18 @@ + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; ++ msys) ++ basic_machine=i386-pc ++ os=-msys ++ ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ++ nacl) ++ basic_machine=le32-unknown ++ os=-nacl ++ ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 +@@ -796,6 +908,12 @@ + np1) + basic_machine=np1-gould + ;; ++ neo-tandem) ++ basic_machine=neo-tandem ++ ;; ++ nse-tandem) ++ basic_machine=nse-tandem ++ ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; +@@ -826,6 +944,14 @@ + basic_machine=i860-intel + os=-osf + ;; ++ parisc) ++ basic_machine=hppa-unknown ++ os=-linux ++ ;; ++ parisc-*) ++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + pbd) + basic_machine=sparc-tti + ;; +@@ -870,9 +996,10 @@ + ;; + power) basic_machine=power-ibm + ;; +- ppc) basic_machine=powerpc-unknown ++ ppc | ppcbe) basic_machine=powerpc-unknown + ;; +- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ppc-* | ppcbe-*) ++ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown +@@ -927,6 +1054,10 @@ + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; ++ sde) ++ basic_machine=mipsisa32-sde ++ os=-elf ++ ;; + sei) + basic_machine=mips-sei + os=-seiux +@@ -938,6 +1069,9 @@ + basic_machine=sh-hitachi + os=-hms + ;; ++ sh5el) ++ basic_machine=sh5le-unknown ++ ;; + sh64) + basic_machine=sh64-unknown + ;; +@@ -959,6 +1093,9 @@ + basic_machine=i860-stratus + os=-sysv4 + ;; ++ strongarm-* | thumb-*) ++ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + sun2) + basic_machine=m68000-sun + ;; +@@ -1015,17 +1152,9 @@ + basic_machine=t90-cray + os=-unicos + ;; +- tic54x | c54x*) +- basic_machine=tic54x-unknown +- os=-coff +- ;; +- tic55x | c55x*) +- basic_machine=tic55x-unknown +- os=-coff +- ;; +- tic6x | c6x*) +- basic_machine=tic6x-unknown +- os=-coff ++ tile*) ++ basic_machine=$basic_machine-unknown ++ os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown +@@ -1094,6 +1223,9 @@ + xps | xps100) + basic_machine=xps100-honeywell + ;; ++ xscale-* | xscalee[bl]-*) ++ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ++ ;; + ymp) + basic_machine=ymp-cray + os=-unicos +@@ -1102,6 +1234,10 @@ + basic_machine=z8k-unknown + os=-sim + ;; ++ z80-*-coff) ++ basic_machine=z80-unknown ++ os=-sim ++ ;; + none) + basic_machine=none-none + os=-none +@@ -1140,7 +1276,7 @@ + we32k) + basic_machine=we32k-att + ;; +- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) ++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) +@@ -1187,9 +1323,12 @@ + if [ x"$os" != x"" ] + then + case $os in +- # First match some system type aliases +- # that might get confused with valid system types. ++ # First match some system type aliases ++ # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. ++ -auroraux) ++ os=-auroraux ++ ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; +@@ -1210,21 +1349,23 @@ + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ +- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ ++ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ ++ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ ++ | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +- | -aos* \ ++ | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ +- | -openbsd* | -solidbsd* \ ++ | -bitrig* | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ +- | -chorusos* | -chorusrdb* \ +- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ ++ | -chorusos* | -chorusrdb* | -cegcc* \ ++ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ ++ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ ++ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ +@@ -1232,7 +1373,7 @@ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ +- | -skyos* | -haiku* | -rdos* | -toppers* | -irx*) ++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1271,7 +1412,7 @@ + -opened*) + os=-openedition + ;; +- -os400*) ++ -os400*) + os=-os400 + ;; + -wince*) +@@ -1320,7 +1461,7 @@ + -sinix*) + os=-sysv4 + ;; +- -tpf*) ++ -tpf*) + os=-tpf + ;; + -triton*) +@@ -1362,6 +1503,11 @@ + -zvmoe) + os=-zvmoe + ;; ++ -dicos*) ++ os=-dicos ++ ;; ++ -nacl*) ++ ;; + -none) + ;; + *) +@@ -1384,7 +1530,10 @@ + # system, and we'll never get to this point. + + case $basic_machine in +- spu-*) ++ score-*) ++ os=-elf ++ ;; ++ spu-*) + os=-elf + ;; + *-acorn) +@@ -1396,8 +1545,20 @@ + arm*-semi) + os=-aout + ;; +- c4x-* | tic4x-*) +- os=-coff ++ c4x-* | tic4x-*) ++ os=-coff ++ ;; ++ hexagon-*) ++ os=-elf ++ ;; ++ tic54x-*) ++ os=-coff ++ ;; ++ tic55x-*) ++ os=-coff ++ ;; ++ tic6x-*) ++ os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) +@@ -1417,13 +1578,13 @@ + ;; + m68000-sun) + os=-sunos3 +- # This also exists in the configure program, but was not the +- # default. +- # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; ++ mep-*) ++ os=-elf ++ ;; + mips*-cisco) + os=-elf + ;; +@@ -1448,7 +1609,7 @@ + *-ibm) + os=-aix + ;; +- *-knuth) ++ *-knuth) + os=-mmixware + ;; + *-wec) +@@ -1553,7 +1714,7 @@ + -sunos*) + vendor=sun + ;; +- -aix*) ++ -cnk*|-aix*) + vendor=ibm + ;; + -beos*) diff --git a/gd-gdcalloc.patch b/gd-gdcalloc.patch new file mode 100644 index 0000000..00815ad --- /dev/null +++ b/gd-gdcalloc.patch @@ -0,0 +1,25 @@ +diff --git a/src/gd.h b/src/gd.h +index 50dfe7f..1a33e98 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -729,6 +729,7 @@ BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level); + BGD_DECLARE(void) gdImageWBMP (gdImagePtr image, int fg, FILE * out); + BGD_DECLARE(void) gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out); + ++BGD_DECLARE(void *) gdCalloc (size_t nmemb, size_t size); + /* Guaranteed to correctly free memory returned by the gdImage*Ptr + functions */ + BGD_DECLARE(void) gdFree (void *m); +diff --git a/src/gdhelpers.c b/src/gdhelpers.c +index 577e9d5..0e6cf61 100644 +--- a/src/gdhelpers.c ++++ b/src/gdhelpers.c +@@ -61,7 +61,7 @@ gd_strtok_r (char *s, char *sep, char **state) + return result; + } + +-void * ++BGD_DECLARE(void *) + gdCalloc (size_t nmemb, size_t size) + { + return calloc (nmemb, size); diff --git a/gd-loop.patch b/gd-loop.patch new file mode 100644 index 0000000..9d08965 --- /dev/null +++ b/gd-loop.patch @@ -0,0 +1,24 @@ +diff -up gd-2.0.35/gd_gif_in.c.loop gd-2.0.35/gd_gif_in.c +--- gd-2.0.35/gd_gif_in.c.loop 2007-06-14 15:51:41.000000000 -0400 ++++ gd-2.0.35/gd_gif_in.c 2008-07-21 11:20:25.000000000 -0400 +@@ -453,16 +453,17 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DAT + return sd->firstcode; + } else if (code == sd->end_code) { + int count; ++ int max_count = 1024; + unsigned char buf[260]; + + if (*ZeroDataBlockP) + return -2; + +- while ((count = GetDataBlock(fd, buf, ZeroDataBlockP)) > 0) ++ while ((count = GetDataBlock(fd, buf, ZeroDataBlockP)) > 0 && --max_count >= 0 ) + ; + +- if (count != 0) +- return -2; ++ if (count != 0 || max_count < 0 ) ++ return -2; + } + + incode = code; diff --git a/gd-sa1.patch b/gd-sa1.patch new file mode 100644 index 0000000..dc2b1b9 --- /dev/null +++ b/gd-sa1.patch @@ -0,0 +1,59 @@ +These issues were found by Coverity static analysis tool + +Error: DEADCODE (CWE-561): [#def3] +gd-2.0.35/gd.c:3494: cond_cannot_single: Condition "dx == 0L", taking false branch. Now the value of "dx" cannot be equal to 0. +gd-2.0.35/gd.c:3502: cannot_single: At condition "dx == 0L", the value of "dx" cannot be equal to 0. +gd-2.0.35/gd.c:3502: dead_error_condition: The condition "dx == 0L" cannot be true. +gd-2.0.35/gd.c:3502: dead_error_line: Execution cannot reach this expression "dy == 0L" inside statement "if (dx == 0L && dy == 0L){ +...". + +Error: DEADCODE (CWE-561): [#def4] +gd-2.0.35/gd.c:1085: cond_cannot_single: Condition "dx == 0", taking false branch. Now the value of "dx" cannot be equal to 0. +gd-2.0.35/gd.c:1097: cannot_single: At condition "dx == 0", the value of "dx" cannot be equal to 0. +gd-2.0.35/gd.c:1097: dead_error_condition: The condition "dx == 0" cannot be true. +gd-2.0.35/gd.c:1097: dead_error_line: Execution cannot reach this expression "dy == 0" inside statement "if (dx == 0 && dy == 0){ + ...". + + +diff -up gd-2.0.35/gd.c.sa1 gd-2.0.35/gd.c +--- gd-2.0.35/gd.c.sa1 2012-12-05 16:23:09.289667430 +0100 ++++ gd-2.0.35/gd.c 2012-12-05 16:30:41.634854587 +0100 +@@ -1094,11 +1094,6 @@ BGD_DECLARE(void) gdImageLine (gdImagePt + { + /* More-or-less horizontal. use wid for vertical stroke */ + /* Doug Claar: watch out for NaN in atan2 (2.0.5) */ +- if ((dx == 0) && (dy == 0)) +- { +- wid = 1; +- } +- else + { + /* 2.0.12: Michael Schwartz: divide rather than multiply; + TBB: but watch out for /0! */ +@@ -3490,6 +3485,12 @@ static void gdImageAALine (gdImagePtr im + dx = x2 - x1; + dy = y2 - y1; + ++ if (dx == 0 && dy == 0) { ++ /* TBB: allow setting points */ ++ gdImageSetAAPixelColor(im, x1, y1, col, 0xFF); ++ return; ++ } ++ + /* Axis aligned lines */ + if (dx == 0) { + gdImageVLine(im, x1, y1, y2, col); +@@ -3499,12 +3500,7 @@ static void gdImageAALine (gdImagePtr im + return; + } + +- if (dx == 0 && dy == 0) { +- /* TBB: allow setting points */ +- gdImageSetAAPixelColor(im, x1, y1, col, 0xFF); +- return; +- } +- else { ++ { + double ag; + if (abs(dy) < abs(dx)) + ag = cos (atan2 (dy, dx)); diff --git a/gd-sa2.patch b/gd-sa2.patch new file mode 100644 index 0000000..61abb28 --- /dev/null +++ b/gd-sa2.patch @@ -0,0 +1,515 @@ +The following issues have been found by Coverity static analysis tool: + +Error: RESOURCE_LEAK (CWE-404): [#def25] +gd-2.0.35/gd.c:2436: cond_false: Condition "overflow2(4 /* sizeof (int) */, srcW)", taking false branch +gd-2.0.35/gd.c:2438: if_end: End of if statement +gd-2.0.35/gd.c:2439: cond_false: Condition "overflow2(4 /* sizeof (int) */, srcH)", taking false branch +gd-2.0.35/gd.c:2441: if_end: End of if statement +gd-2.0.35/gd.c:2442: alloc_fn: Storage is returned from allocation function "gdMalloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: alloc_fn: Storage is returned from allocation function "malloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)". +gd-2.0.35/gd.c:2442: var_assign: Assigning: "stx" = storage returned from "gdMalloc(4UL * srcW)". +gd-2.0.35/gd.c:2443: cond_false: Condition "!stx", taking false branch +gd-2.0.35/gd.c:2445: if_end: End of if statement +gd-2.0.35/gd.c:2448: cond_true: Condition "!sty", taking true branch +gd-2.0.35/gd.c:2449: leaked_storage: Variable "stx" going out of scope leaks the storage it points to. + +Error: RESOURCE_LEAK (CWE-404): [#def26] +gd-2.0.35/gd.c:2016: cond_false: Condition "!im->tile", taking false branch +gd-2.0.35/gd.c:2018: if_end: End of if statement +gd-2.0.35/gd.c:2021: cond_true: Condition "nc == -5", taking true branch +gd-2.0.35/gd.c:2024: alloc_fn: Storage is returned from allocation function "gdCalloc(size_t, size_t)". +gd-2.0.35/gdhelpers.c:79:3: alloc_fn: Storage is returned from allocation function "calloc(size_t, size_t)". +gd-2.0.35/gdhelpers.c:79:3: return_alloc_fn: Directly returning storage allocated by "calloc(size_t, size_t)". +gd-2.0.35/gd.c:2024: var_assign: Assigning: "pts" = storage returned from "gdCalloc(8UL * im->sy, 4UL)". +gd-2.0.35/gd.c:2025: cond_false: Condition "!pts", taking false branch +gd-2.0.35/gd.c:2027: if_end: End of if statement +gd-2.0.35/gd.c:2029: cond_true: Condition "i < im->sy", taking true branch +gd-2.0.35/gd.c:2032: cond_true: Condition "!pts[i]", taking true branch +gd-2.0.35/gd.c:2033: cond_false: Condition "i >= 0", taking false branch +gd-2.0.35/gd.c:2035: loop_end: Reached end of loop +gd-2.0.35/gd.c:2036: leaked_storage: Variable "pts" going out of scope leaks the storage it points to. + +Error: RESOURCE_LEAK (CWE-404): [#def27] +gd-2.0.35/gd.c:2016: cond_false: Condition "!im->tile", taking false branch +gd-2.0.35/gd.c:2018: if_end: End of if statement +gd-2.0.35/gd.c:2021: cond_true: Condition "nc == -5", taking true branch +gd-2.0.35/gd.c:2024: alloc_fn: Storage is returned from allocation function "gdCalloc(size_t, size_t)". +gd-2.0.35/gdhelpers.c:79:3: alloc_fn: Storage is returned from allocation function "calloc(size_t, size_t)". +gd-2.0.35/gdhelpers.c:79:3: return_alloc_fn: Directly returning storage allocated by "calloc(size_t, size_t)". +gd-2.0.35/gd.c:2024: var_assign: Assigning: "pts" = storage returned from "gdCalloc(8UL * im->sy, 4UL)". +gd-2.0.35/gd.c:2025: cond_false: Condition "!pts", taking false branch +gd-2.0.35/gd.c:2027: if_end: End of if statement +gd-2.0.35/gd.c:2029: cond_true: Condition "i < im->sy", taking true branch +gd-2.0.35/gd.c:2032: cond_false: Condition "!pts[i]", taking false branch +gd-2.0.35/gd.c:2037: if_end: End of if statement +gd-2.0.35/gd.c:2038: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd.c:2029: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd.c:2029: cond_true: Condition "i < im->sy", taking true branch +gd-2.0.35/gd.c:2032: cond_false: Condition "!pts[i]", taking false branch +gd-2.0.35/gd.c:2037: if_end: End of if statement +gd-2.0.35/gd.c:2038: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd.c:2029: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd.c:2029: cond_false: Condition "i < im->sy", taking false branch +gd-2.0.35/gd.c:2038: loop_end: Reached end of loop +gd-2.0.35/gd.c:2041: cond_true: Condition "!stack", taking true branch +gd-2.0.35/gd.c:2042: leaked_storage: Variable "pts" going out of scope leaks the storage it points to. + +Error: RESOURCE_LEAK (CWE-404): [#def28] +gd-2.0.35/gd.c:2803: cond_false: Condition "!fgets(s, 160, fd)", taking false branch +gd-2.0.35/gd.c:2806: if_end: End of if statement +gd-2.0.35/gd.c:2810: cond_false: Condition "!sp", taking false branch +gd-2.0.35/gd.c:2813: if_end: End of if statement +gd-2.0.35/gd.c:2817: cond_false: Condition "!sp", taking false branch +gd-2.0.35/gd.c:2820: if_end: End of if statement +gd-2.0.35/gd.c:2823: cond_false: Condition "!w", taking false branch +gd-2.0.35/gd.c:2826: if_end: End of if statement +gd-2.0.35/gd.c:2827: cond_false: Condition "!fgets(s, 160, fd)", taking false branch +gd-2.0.35/gd.c:2830: if_end: End of if statement +gd-2.0.35/gd.c:2834: cond_false: Condition "!sp", taking false branch +gd-2.0.35/gd.c:2837: if_end: End of if statement +gd-2.0.35/gd.c:2841: cond_false: Condition "!sp", taking false branch +gd-2.0.35/gd.c:2844: if_end: End of if statement +gd-2.0.35/gd.c:2847: cond_false: Condition "!h", taking false branch +gd-2.0.35/gd.c:2850: if_end: End of if statement +gd-2.0.35/gd.c:2852: cond_false: Condition "!fgets(s, 160, fd)", taking false branch +gd-2.0.35/gd.c:2855: if_end: End of if statement +gd-2.0.35/gd.c:2857: alloc_fn: Storage is returned from allocation function "gdImageCreate(int, int)". +gd-2.0.35/gd.c:76:3: cond_false: Condition "overflow2(8 /* sizeof (unsigned char *) */, sy)", taking false branch +gd-2.0.35/gd.c:78:3: if_end: End of if statement +gd-2.0.35/gd.c:79:3: cond_false: Condition "overflow2(8 /* sizeof (unsigned char *) */, sx)", taking false branch +gd-2.0.35/gd.c:81:3: if_end: End of if statement +gd-2.0.35/gd.c:83:3: alloc_fn: Storage is returned from allocation function "gdMalloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: alloc_fn: Storage is returned from allocation function "malloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)". +gd-2.0.35/gd.c:83:3: var_assign: Assigning: "im" = "gdMalloc(7304UL)". +gd-2.0.35/gd.c:84:2: cond_false: Condition "!im", taking false branch +gd-2.0.35/gd.c:86:2: if_end: End of if statement +gd-2.0.35/gd.c:88:3: noescape: Resource "im" is not freed or pointed-to in function "memset(void *, int, size_t)". +gd-2.0.35/gd.c:91:2: cond_false: Condition "!im->pixels", taking false branch +gd-2.0.35/gd.c:94:2: if_end: End of if statement +gd-2.0.35/gd.c:101:3: cond_true: Condition "i < sy", taking true branch +gd-2.0.35/gd.c:105:4: cond_false: Condition "!im->pixels[i]", taking false branch +gd-2.0.35/gd.c:114:4: if_end: End of if statement +gd-2.0.35/gd.c:116:5: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd.c:101:3: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd.c:101:3: cond_true: Condition "i < sy", taking true branch +gd-2.0.35/gd.c:105:4: cond_false: Condition "!im->pixels[i]", taking false branch +gd-2.0.35/gd.c:114:4: if_end: End of if statement +gd-2.0.35/gd.c:116:5: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd.c:101:3: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd.c:101:3: cond_true: Condition "i < sy", taking true branch +gd-2.0.35/gd.c:105:4: cond_false: Condition "!im->pixels[i]", taking false branch +gd-2.0.35/gd.c:114:4: if_end: End of if statement +gd-2.0.35/gd.c:116:5: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd.c:101:3: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd.c:101:3: cond_false: Condition "i < sy", taking false branch +gd-2.0.35/gd.c:116:5: loop_end: Reached end of loop +gd-2.0.35/gd.c:124:3: cond_true: Condition "i < 256", taking true branch +gd-2.0.35/gd.c:130:5: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd.c:124:3: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd.c:124:3: cond_true: Condition "i < 256", taking true branch +gd-2.0.35/gd.c:130:5: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd.c:124:3: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd.c:124:3: cond_false: Condition "i < 256", taking false branch +gd-2.0.35/gd.c:130:5: loop_end: Reached end of loop +gd-2.0.35/gd.c:137:3: return_alloc: Returning allocated memory "im". +gd-2.0.35/gd.c:2857: var_assign: Assigning: "im" = storage returned from "gdImageCreate(w, h)". +gd-2.0.35/gd.c:2858: cond_false: Condition "!im", taking false branch +gd-2.0.35/gd.c:2860: if_end: End of if statement +gd-2.0.35/gd.c:2862: noescape: Resource "im" is not freed or pointed-to in function "gdImageColorAllocate(gdImagePtr, int, int, int)". +gd-2.0.35/gd.c:478:51: noescape: "gdImageColorAllocate(gdImagePtr, int, int, int)" does not free or save its pointer parameter "im". +gd-2.0.35/gd.c:2863: noescape: Resource "im" is not freed or pointed-to in function "gdImageColorAllocate(gdImagePtr, int, int, int)". +gd-2.0.35/gd.c:478:51: noescape: "gdImageColorAllocate(gdImagePtr, int, int, int)" does not free or save its pointer parameter "im". +gd-2.0.35/gd.c:2866: cond_false: Condition "i < bytes", taking false branch +gd-2.0.35/gd.c:2913: loop_end: Reached end of loop +gd-2.0.35/gd.c:2916: leaked_storage: Variable "im" going out of scope leaks the storage it points to. + +Error: RESOURCE_LEAK (CWE-404): [#def29] +gd-2.0.35/gdft.c:881: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:883: cond_true: Condition "(strex->flags & 1) == 1", taking true branch +gd-2.0.35/gdft.c:888: alloc_fn: Storage is returned from allocation function "gdCacheCreate(int, gdCacheTestFn_t, gdCacheFetchFn_t, gdCacheReleaseFn_t)". +gd-2.0.35/gdcache.c:73:3: alloc_fn: Storage is returned from allocation function "gdMalloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: alloc_fn: Storage is returned from allocation function "malloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)". +gd-2.0.35/gdcache.c:73:3: var_assign: Assigning: "head" = "gdMalloc(48UL)". +gd-2.0.35/gdcache.c:74:2: cond_false: Condition "!head", taking false branch +gd-2.0.35/gdcache.c:76:2: if_end: End of if statement +gd-2.0.35/gdcache.c:83:3: return_alloc: Returning allocated memory "head". +gd-2.0.35/gdft.c:888: var_assign: Assigning: "tc_cache" = storage returned from "gdCacheCreate(32, tweenColorTest(void *, void *), tweenColorFetch(char **, void *), tweenColorRelease(void *))". +gd-2.0.35/gdft.c:893: cond_true: Condition "!fontCache", taking true branch +gd-2.0.35/gdft.c:895: cond_false: Condition "gdFontCacheSetup() != 0", taking false branch +gd-2.0.35/gdft.c:899: if_end: End of if statement +gd-2.0.35/gdft.c:905: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:906: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:909: if_end: End of if statement +gd-2.0.35/gdft.c:912: cond_false: Condition "!font", taking false branch +gd-2.0.35/gdft.c:917: if_end: End of if statement +gd-2.0.35/gdft.c:921: cond_true: Condition "brect", taking true branch +gd-2.0.35/gdft.c:935: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:937: cond_true: Condition "strex->flags & 4", taking true branch +gd-2.0.35/gdft.c:942: cond_true: Condition "strex->flags & 0x10", taking true branch +gd-2.0.35/gdft.c:948: cond_true: Condition "strex->flags & 2", taking true branch +gd-2.0.35/gdft.c:953: cond_true: Condition "strex->flags & 0x80", taking true branch +gd-2.0.35/gdft.c:954: cond_false: Condition "0", taking false branch +gd-2.0.35/gdft.c:954: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:956: if_end: End of if statement +gd-2.0.35/gdft.c:969: cond_false: Condition "FT_Set_Char_Size(face, 0, (FT_F26Dot6)(ptsize * 64), 300, 300)", taking false branch +gd-2.0.35/gdft.c:974: if_end: End of if statement +gd-2.0.35/gdft.c:976: cond_true: Condition "render", taking true branch +gd-2.0.35/gdft.c:980: cond_false: Condition "FT_Set_Char_Size(face, 0, (FT_F26Dot6)(ptsize * 64), hdpi, vdpi)", taking false branch +gd-2.0.35/gdft.c:985: if_end: End of if statement +gd-2.0.35/gdft.c:988: cond_true: Condition "fg < 0", taking true branch +gd-2.0.35/gdft.c:993: cond_true: Condition "i < face->num_charmaps", taking true branch +gd-2.0.35/gdft.c:998: cond_true: Condition "encoding == 0", taking true branch +gd-2.0.35/gdft.c:1000: cond_true: Condition "charmap->encoding == FT_ENCODING_MS_SYMBOL", taking true branch +gd-2.0.35/gdft.c:1006: break: Breaking from loop +gd-2.0.35/gdft.c:1070: loop_end: Reached end of loop +gd-2.0.35/gdft.c:1071: cond_true: Condition "encodingfound", taking true branch +gd-2.0.35/gdft.c:1074: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:1080: if_end: End of if statement +gd-2.0.35/gdft.c:1083: cond_false: Condition "encoding == 1", taking false branch +gd-2.0.35/gdft.c:1098: else_branch: Reached else branch +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_true: Condition "ch == 13", taking true branch +gd-2.0.35/gdft.c:1122: continue: Continuing loop +gd-2.0.35/gdft.c:1355: loop: Looping back +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_true: Condition "ch == 13", taking true branch +gd-2.0.35/gdft.c:1122: continue: Continuing loop +gd-2.0.35/gdft.c:1355: loop: Looping back +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_false: Condition "ch == 13", taking false branch +gd-2.0.35/gdft.c:1123: if_end: End of if statement +gd-2.0.35/gdft.c:1125: cond_true: Condition "ch == 10", taking true branch +gd-2.0.35/gdft.c:1133: continue: Continuing loop +gd-2.0.35/gdft.c:1355: loop: Looping back +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_false: Condition "ch == 13", taking false branch +gd-2.0.35/gdft.c:1123: if_end: End of if statement +gd-2.0.35/gdft.c:1125: cond_false: Condition "ch == 10", taking false branch +gd-2.0.35/gdft.c:1134: if_end: End of if statement +gd-2.0.35/gdft.c:1137: switch: Switch case value "0" +gd-2.0.35/gdft.c:1139: switch_case: Reached case "0" +gd-2.0.35/gdft.c:1147: cond_true: Condition "charmap->encoding == FT_ENCODING_MS_SYMBOL", taking true branch +gd-2.0.35/gdft.c:1160: break: Breaking from switch +gd-2.0.35/gdft.c:1218: switch_end: Reached end of switch +gd-2.0.35/gdft.c:1224: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:1224: cond_false: Condition "strex->flags & 8", taking false branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "!(face->face_flags & (4L /* 1L << 2 */))", taking true branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "face->face_flags & (64L /* 1L << 6 */)", taking true branch +gd-2.0.35/gdft.c:1224: cond_false: Condition "previous", taking false branch +gd-2.0.35/gdft.c:1231: else_branch: Reached else branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "i", taking true branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "strex->flags & 0x10", taking true branch +gd-2.0.35/gdft.c:1242: cond_true: Condition "!xshow_alloc", taking true branch +gd-2.0.35/gdft.c:1245: cond_false: Condition "!strex->xshow", taking false branch +gd-2.0.35/gdft.c:1247: if_end: End of if statement +gd-2.0.35/gdft.c:1249: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:1256: if_end: End of if statement +gd-2.0.35/gdft.c:1264: cond_false: Condition "err", taking false branch +gd-2.0.35/gdft.c:1269: if_end: End of if statement +gd-2.0.35/gdft.c:1273: cond_true: Condition "brect", taking true branch +gd-2.0.35/gdft.c:1281: cond_false: Condition "ch == 32", taking false branch +gd-2.0.35/gdft.c:1286: else_branch: Reached else branch +gd-2.0.35/gdft.c:1295: cond_false: Condition "i == 0", taking false branch +gd-2.0.35/gdft.c:1301: else_branch: Reached else branch +gd-2.0.35/gdft.c:1302: cond_true: Condition "glyph_min.x < total_min.x", taking true branch +gd-2.0.35/gdft.c:1304: cond_true: Condition "glyph_min.y < total_min.y", taking true branch +gd-2.0.35/gdft.c:1306: cond_true: Condition "glyph_max.x > total_max.x", taking true branch +gd-2.0.35/gdft.c:1308: cond_true: Condition "glyph_max.y > total_max.y", taking true branch +gd-2.0.35/gdft.c:1313: cond_true: Condition "render", taking true branch +gd-2.0.35/gdft.c:1319: cond_false: Condition "err", taking false branch +gd-2.0.35/gdft.c:1324: if_end: End of if statement +gd-2.0.35/gdft.c:1329: cond_true: Condition "image->format != FT_GLYPH_FORMAT_BITMAP", taking true branch +gd-2.0.35/gdft.c:1332: cond_false: Condition "err", taking false branch +gd-2.0.35/gdft.c:1337: if_end: End of if statement +gd-2.0.35/gdft.c:1344: noescape: Resource "tc_cache" is not freed or pointed-to in function "gdft_draw_bitmap(gdCache_head_t *, gdImage *, int, FT_Bitmap, int, int)". +gd-2.0.35/gdft.c:614:36: noescape: "gdft_draw_bitmap(gdCache_head_t *, gdImage *, int, FT_Bitmap, int, int)" does not free or save its pointer parameter "tc_cache". +gd-2.0.35/gdft.c:1355: loop: Jumping back to the beginning of the loop +gd-2.0.35/gdft.c:1110: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_false: Condition "ch == 13", taking false branch +gd-2.0.35/gdft.c:1123: if_end: End of if statement +gd-2.0.35/gdft.c:1125: cond_false: Condition "ch == 10", taking false branch +gd-2.0.35/gdft.c:1134: if_end: End of if statement +gd-2.0.35/gdft.c:1137: switch: Switch case value "0" +gd-2.0.35/gdft.c:1139: switch_case: Reached case "0" +gd-2.0.35/gdft.c:1147: cond_true: Condition "charmap->encoding == FT_ENCODING_MS_SYMBOL", taking true branch +gd-2.0.35/gdft.c:1160: break: Breaking from switch +gd-2.0.35/gdft.c:1218: switch_end: Reached end of switch +gd-2.0.35/gdft.c:1224: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:1224: cond_false: Condition "strex->flags & 8", taking false branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "!(face->face_flags & (4L /* 1L << 2 */))", taking true branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "face->face_flags & (64L /* 1L << 6 */)", taking true branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "previous", taking true branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "glyph_index", taking true branch +gd-2.0.35/gdft.c:1229: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:1231: if_end: End of if statement +gd-2.0.35/gdft.c:1238: cond_true: Condition "i", taking true branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "strex->flags & 0x10", taking true branch +gd-2.0.35/gdft.c:1242: cond_false: Condition "!xshow_alloc", taking false branch +gd-2.0.35/gdft.c:1250: else_branch: Reached else branch +gd-2.0.35/gdft.c:1250: cond_true: Condition "xshow_pos + 20 > xshow_alloc", taking true branch +gd-2.0.35/gdft.c:1253: cond_false: Condition "!strex->xshow", taking false branch +gd-2.0.35/gdft.c:1255: if_end: End of if statement +gd-2.0.35/gdft.c:1264: cond_false: Condition "err", taking false branch +gd-2.0.35/gdft.c:1269: if_end: End of if statement +gd-2.0.35/gdft.c:1273: cond_true: Condition "brect", taking true branch +gd-2.0.35/gdft.c:1281: cond_false: Condition "ch == 32", taking false branch +gd-2.0.35/gdft.c:1286: else_branch: Reached else branch +gd-2.0.35/gdft.c:1295: cond_false: Condition "i == 0", taking false branch +gd-2.0.35/gdft.c:1301: else_branch: Reached else branch +gd-2.0.35/gdft.c:1302: cond_true: Condition "glyph_min.x < total_min.x", taking true branch +gd-2.0.35/gdft.c:1304: cond_true: Condition "glyph_min.y < total_min.y", taking true branch +gd-2.0.35/gdft.c:1306: cond_true: Condition "glyph_max.x > total_max.x", taking true branch +gd-2.0.35/gdft.c:1308: cond_true: Condition "glyph_max.y > total_max.y", taking true branch +gd-2.0.35/gdft.c:1313: cond_true: Condition "render", taking true branch +gd-2.0.35/gdft.c:1319: cond_false: Condition "err", taking false branch +gd-2.0.35/gdft.c:1324: if_end: End of if statement +gd-2.0.35/gdft.c:1329: cond_true: Condition "image->format != FT_GLYPH_FORMAT_BITMAP", taking true branch +gd-2.0.35/gdft.c:1332: cond_false: Condition "err", taking false branch +gd-2.0.35/gdft.c:1337: if_end: End of if statement +gd-2.0.35/gdft.c:1344: noescape: Resource "tc_cache" is not freed or pointed-to in function "gdft_draw_bitmap(gdCache_head_t *, gdImage *, int, FT_Bitmap, int, int)". +gd-2.0.35/gdft.c:614:36: noescape: "gdft_draw_bitmap(gdCache_head_t *, gdImage *, int, FT_Bitmap, int, int)" does not free or save its pointer parameter "tc_cache". +gd-2.0.35/gdft.c:1355: loop: Jumping back to the beginning of the loop +gd-2.0.35/gdft.c:1110: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_false: Condition "ch == 13", taking false branch +gd-2.0.35/gdft.c:1123: if_end: End of if statement +gd-2.0.35/gdft.c:1125: cond_false: Condition "ch == 10", taking false branch +gd-2.0.35/gdft.c:1134: if_end: End of if statement +gd-2.0.35/gdft.c:1137: switch: Switch case value "0" +gd-2.0.35/gdft.c:1139: switch_case: Reached case "0" +gd-2.0.35/gdft.c:1147: cond_true: Condition "charmap->encoding == FT_ENCODING_MS_SYMBOL", taking true branch +gd-2.0.35/gdft.c:1160: break: Breaking from switch +gd-2.0.35/gdft.c:1218: switch_end: Reached end of switch +gd-2.0.35/gdft.c:1224: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:1224: cond_false: Condition "strex->flags & 8", taking false branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "!(face->face_flags & (4L /* 1L << 2 */))", taking true branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "face->face_flags & (64L /* 1L << 6 */)", taking true branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "previous", taking true branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "glyph_index", taking true branch +gd-2.0.35/gdft.c:1229: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:1231: if_end: End of if statement +gd-2.0.35/gdft.c:1238: cond_true: Condition "i", taking true branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "strex->flags & 0x10", taking true branch +gd-2.0.35/gdft.c:1242: cond_false: Condition "!xshow_alloc", taking false branch +gd-2.0.35/gdft.c:1250: else_branch: Reached else branch +gd-2.0.35/gdft.c:1250: cond_true: Condition "xshow_pos + 20 > xshow_alloc", taking true branch +gd-2.0.35/gdft.c:1253: cond_true: Condition "!strex->xshow", taking true branch +gd-2.0.35/gdft.c:1254: leaked_storage: Variable "tc_cache" going out of scope leaks the storage it points to. + +Error: RESOURCE_LEAK (CWE-404): [#def30] +gd-2.0.35/gdft.c:881: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:883: cond_true: Condition "(strex->flags & 1) == 1", taking true branch +gd-2.0.35/gdft.c:888: alloc_fn: Storage is returned from allocation function "gdCacheCreate(int, gdCacheTestFn_t, gdCacheFetchFn_t, gdCacheReleaseFn_t)". +gd-2.0.35/gdcache.c:73:3: alloc_fn: Storage is returned from allocation function "gdMalloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: alloc_fn: Storage is returned from allocation function "malloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)". +gd-2.0.35/gdcache.c:73:3: var_assign: Assigning: "head" = "gdMalloc(48UL)". +gd-2.0.35/gdcache.c:74:2: cond_false: Condition "!head", taking false branch +gd-2.0.35/gdcache.c:76:2: if_end: End of if statement +gd-2.0.35/gdcache.c:83:3: return_alloc: Returning allocated memory "head". +gd-2.0.35/gdft.c:888: var_assign: Assigning: "tc_cache" = storage returned from "gdCacheCreate(32, tweenColorTest(void *, void *), tweenColorFetch(char **, void *), tweenColorRelease(void *))". +gd-2.0.35/gdft.c:893: cond_true: Condition "!fontCache", taking true branch +gd-2.0.35/gdft.c:895: cond_false: Condition "gdFontCacheSetup() != 0", taking false branch +gd-2.0.35/gdft.c:899: if_end: End of if statement +gd-2.0.35/gdft.c:905: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:906: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:909: if_end: End of if statement +gd-2.0.35/gdft.c:912: cond_false: Condition "!font", taking false branch +gd-2.0.35/gdft.c:917: if_end: End of if statement +gd-2.0.35/gdft.c:921: cond_true: Condition "brect", taking true branch +gd-2.0.35/gdft.c:935: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:937: cond_true: Condition "strex->flags & 4", taking true branch +gd-2.0.35/gdft.c:942: cond_true: Condition "strex->flags & 0x10", taking true branch +gd-2.0.35/gdft.c:948: cond_true: Condition "strex->flags & 2", taking true branch +gd-2.0.35/gdft.c:953: cond_true: Condition "strex->flags & 0x80", taking true branch +gd-2.0.35/gdft.c:954: cond_false: Condition "0", taking false branch +gd-2.0.35/gdft.c:954: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:956: if_end: End of if statement +gd-2.0.35/gdft.c:969: cond_false: Condition "FT_Set_Char_Size(face, 0, (FT_F26Dot6)(ptsize * 64), 300, 300)", taking false branch +gd-2.0.35/gdft.c:974: if_end: End of if statement +gd-2.0.35/gdft.c:976: cond_true: Condition "render", taking true branch +gd-2.0.35/gdft.c:980: cond_false: Condition "FT_Set_Char_Size(face, 0, (FT_F26Dot6)(ptsize * 64), hdpi, vdpi)", taking false branch +gd-2.0.35/gdft.c:985: if_end: End of if statement +gd-2.0.35/gdft.c:988: cond_true: Condition "fg < 0", taking true branch +gd-2.0.35/gdft.c:993: cond_true: Condition "i < face->num_charmaps", taking true branch +gd-2.0.35/gdft.c:998: cond_true: Condition "encoding == 0", taking true branch +gd-2.0.35/gdft.c:1000: cond_false: Condition "charmap->encoding == FT_ENCODING_MS_SYMBOL", taking false branch +gd-2.0.35/gdft.c:1000: cond_false: Condition "charmap->encoding == FT_ENCODING_UNICODE", taking false branch +gd-2.0.35/gdft.c:1000: cond_false: Condition "charmap->encoding == FT_ENCODING_ADOBE_CUSTOM", taking false branch +gd-2.0.35/gdft.c:1000: cond_false: Condition "charmap->encoding == FT_ENCODING_ADOBE_STANDARD", taking false branch +gd-2.0.35/gdft.c:1007: if_end: End of if statement +gd-2.0.35/gdft.c:1008: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:1040: if_end: End of if statement +gd-2.0.35/gdft.c:1070: loop: Jumping back to the beginning of the loop +gd-2.0.35/gdft.c:993: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gdft.c:993: cond_true: Condition "i < face->num_charmaps", taking true branch +gd-2.0.35/gdft.c:998: cond_true: Condition "encoding == 0", taking true branch +gd-2.0.35/gdft.c:1000: cond_false: Condition "charmap->encoding == FT_ENCODING_MS_SYMBOL", taking false branch +gd-2.0.35/gdft.c:1000: cond_false: Condition "charmap->encoding == FT_ENCODING_UNICODE", taking false branch +gd-2.0.35/gdft.c:1000: cond_false: Condition "charmap->encoding == FT_ENCODING_ADOBE_CUSTOM", taking false branch +gd-2.0.35/gdft.c:1000: cond_false: Condition "charmap->encoding == FT_ENCODING_ADOBE_STANDARD", taking false branch +gd-2.0.35/gdft.c:1007: if_end: End of if statement +gd-2.0.35/gdft.c:1008: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:1040: if_end: End of if statement +gd-2.0.35/gdft.c:1070: loop: Jumping back to the beginning of the loop +gd-2.0.35/gdft.c:993: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gdft.c:993: cond_false: Condition "i < face->num_charmaps", taking false branch +gd-2.0.35/gdft.c:1070: loop_end: Reached end of loop +gd-2.0.35/gdft.c:1071: cond_false: Condition "encodingfound", taking false branch +gd-2.0.35/gdft.c:1076: else_branch: Reached else branch +gd-2.0.35/gdft.c:1079: leaked_storage: Variable "tc_cache" going out of scope leaks the storage it points to. + +Error: RESOURCE_LEAK (CWE-404): [#def31] +gd-2.0.35/gdft.c:881: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:883: cond_true: Condition "(strex->flags & 1) == 1", taking true branch +gd-2.0.35/gdft.c:888: alloc_fn: Storage is returned from allocation function "gdCacheCreate(int, gdCacheTestFn_t, gdCacheFetchFn_t, gdCacheReleaseFn_t)". +gd-2.0.35/gdcache.c:73:3: alloc_fn: Storage is returned from allocation function "gdMalloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: alloc_fn: Storage is returned from allocation function "malloc(size_t)". +gd-2.0.35/gdhelpers.c:85:3: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)". +gd-2.0.35/gdcache.c:73:3: var_assign: Assigning: "head" = "gdMalloc(48UL)". +gd-2.0.35/gdcache.c:74:2: cond_false: Condition "!head", taking false branch +gd-2.0.35/gdcache.c:76:2: if_end: End of if statement +gd-2.0.35/gdcache.c:83:3: return_alloc: Returning allocated memory "head". +gd-2.0.35/gdft.c:888: var_assign: Assigning: "tc_cache" = storage returned from "gdCacheCreate(32, tweenColorTest(void *, void *), tweenColorFetch(char **, void *), tweenColorRelease(void *))". +gd-2.0.35/gdft.c:893: cond_true: Condition "!fontCache", taking true branch +gd-2.0.35/gdft.c:895: cond_false: Condition "gdFontCacheSetup() != 0", taking false branch +gd-2.0.35/gdft.c:899: if_end: End of if statement +gd-2.0.35/gdft.c:905: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:906: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:909: if_end: End of if statement +gd-2.0.35/gdft.c:912: cond_false: Condition "!font", taking false branch +gd-2.0.35/gdft.c:917: if_end: End of if statement +gd-2.0.35/gdft.c:921: cond_true: Condition "brect", taking true branch +gd-2.0.35/gdft.c:935: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:937: cond_true: Condition "strex->flags & 4", taking true branch +gd-2.0.35/gdft.c:942: cond_true: Condition "strex->flags & 0x10", taking true branch +gd-2.0.35/gdft.c:948: cond_true: Condition "strex->flags & 2", taking true branch +gd-2.0.35/gdft.c:953: cond_true: Condition "strex->flags & 0x80", taking true branch +gd-2.0.35/gdft.c:954: cond_false: Condition "0", taking false branch +gd-2.0.35/gdft.c:954: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:956: if_end: End of if statement +gd-2.0.35/gdft.c:969: cond_false: Condition "FT_Set_Char_Size(face, 0, (FT_F26Dot6)(ptsize * 64), 300, 300)", taking false branch +gd-2.0.35/gdft.c:974: if_end: End of if statement +gd-2.0.35/gdft.c:976: cond_true: Condition "render", taking true branch +gd-2.0.35/gdft.c:980: cond_false: Condition "FT_Set_Char_Size(face, 0, (FT_F26Dot6)(ptsize * 64), hdpi, vdpi)", taking false branch +gd-2.0.35/gdft.c:985: if_end: End of if statement +gd-2.0.35/gdft.c:988: cond_true: Condition "fg < 0", taking true branch +gd-2.0.35/gdft.c:993: cond_true: Condition "i < face->num_charmaps", taking true branch +gd-2.0.35/gdft.c:998: cond_true: Condition "encoding == 0", taking true branch +gd-2.0.35/gdft.c:1000: cond_true: Condition "charmap->encoding == FT_ENCODING_MS_SYMBOL", taking true branch +gd-2.0.35/gdft.c:1006: break: Breaking from loop +gd-2.0.35/gdft.c:1070: loop_end: Reached end of loop +gd-2.0.35/gdft.c:1071: cond_true: Condition "encodingfound", taking true branch +gd-2.0.35/gdft.c:1074: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gdft.c:1080: if_end: End of if statement +gd-2.0.35/gdft.c:1083: cond_false: Condition "encoding == 1", taking false branch +gd-2.0.35/gdft.c:1098: else_branch: Reached else branch +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_true: Condition "ch == 13", taking true branch +gd-2.0.35/gdft.c:1122: continue: Continuing loop +gd-2.0.35/gdft.c:1355: loop: Looping back +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_true: Condition "ch == 13", taking true branch +gd-2.0.35/gdft.c:1122: continue: Continuing loop +gd-2.0.35/gdft.c:1355: loop: Looping back +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_false: Condition "ch == 13", taking false branch +gd-2.0.35/gdft.c:1123: if_end: End of if statement +gd-2.0.35/gdft.c:1125: cond_true: Condition "ch == 10", taking true branch +gd-2.0.35/gdft.c:1133: continue: Continuing loop +gd-2.0.35/gdft.c:1355: loop: Looping back +gd-2.0.35/gdft.c:1110: cond_true: Condition "*next", taking true branch +gd-2.0.35/gdft.c:1117: cond_false: Condition "ch == 13", taking false branch +gd-2.0.35/gdft.c:1123: if_end: End of if statement +gd-2.0.35/gdft.c:1125: cond_false: Condition "ch == 10", taking false branch +gd-2.0.35/gdft.c:1134: if_end: End of if statement +gd-2.0.35/gdft.c:1137: switch: Switch case value "0" +gd-2.0.35/gdft.c:1139: switch_case: Reached case "0" +gd-2.0.35/gdft.c:1147: cond_true: Condition "charmap->encoding == FT_ENCODING_MS_SYMBOL", taking true branch +gd-2.0.35/gdft.c:1160: break: Breaking from switch +gd-2.0.35/gdft.c:1218: switch_end: Reached end of switch +gd-2.0.35/gdft.c:1224: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:1224: cond_false: Condition "strex->flags & 8", taking false branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "!(face->face_flags & (4L /* 1L << 2 */))", taking true branch +gd-2.0.35/gdft.c:1224: cond_true: Condition "face->face_flags & (64L /* 1L << 6 */)", taking true branch +gd-2.0.35/gdft.c:1224: cond_false: Condition "previous", taking false branch +gd-2.0.35/gdft.c:1231: else_branch: Reached else branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "i", taking true branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "strex", taking true branch +gd-2.0.35/gdft.c:1238: cond_true: Condition "strex->flags & 0x10", taking true branch +gd-2.0.35/gdft.c:1242: cond_true: Condition "!xshow_alloc", taking true branch +gd-2.0.35/gdft.c:1245: cond_true: Condition "!strex->xshow", taking true branch +gd-2.0.35/gdft.c:1246: leaked_storage: Variable "tc_cache" going out of scope leaks the storage it points to. + + +diff -up gd-2.0.35/gd.c.sa2 gd-2.0.35/gd.c +--- gd-2.0.35/gd.c.sa2 2012-12-05 17:01:03.989841899 +0100 ++++ gd-2.0.35/gd.c 2012-12-05 17:06:58.283055944 +0100 +@@ -2028,12 +2028,17 @@ void _gdImageFillTiled(gdImagePtr im, in + for (--i ; i >= 0; i--) { + gdFree(pts[i]); + } ++ gdFree(pts); + return; + } + } + + stack = (struct seg *)gdMalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)); + if (!stack) { ++ for (i=0; isy;i++) { ++ gdFree(pts[i]); ++ } ++ gdFree(pts); + return; + } + sp = stack; +@@ -2441,6 +2446,7 @@ BGD_DECLARE(void) gdImageCopyResized (gd + + sty = (int *) gdMalloc (sizeof (int) * srcH); + if (!sty) { ++ gdFree(stx); + return; + } + +@@ -2908,7 +2914,6 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFro + } + /* Shouldn't happen */ + fprintf (stderr, "Error: bug in gdImageCreateFromXbm!\n"); +- return 0; + fail: + gdImageDestroy (im); + return 0; +diff -up gd-2.0.35/gdft.c.sa2 gd-2.0.35/gdft.c +--- gd-2.0.35/gdft.c.sa2 2012-12-05 17:30:16.884852950 +0100 ++++ gd-2.0.35/gdft.c 2012-12-05 17:11:42.635217211 +0100 +@@ -1076,6 +1076,7 @@ BGD_DECLARE(char *) gdImageStringFTEx (g + { + /* No character set found! */ + gdMutexUnlock (gdFontCacheMutex); ++ gdCacheDelete (tc_cache); + return "No character set found"; + } + +@@ -1243,6 +1244,7 @@ fprintf(stderr,"dpi=%d,%d metric_res=%d + xshow_alloc = 100; + strex->xshow = gdMalloc(xshow_alloc); + if (!strex->xshow) { ++ gdCacheDelete (tc_cache); + return 0; + } + xshow_pos = 0; +@@ -1251,6 +1253,7 @@ fprintf(stderr,"dpi=%d,%d metric_res=%d + xshow_alloc += 100; + strex->xshow = gdRealloc(strex->xshow, xshow_alloc); + if (!strex->xshow) { ++ gdCacheDelete (tc_cache); + return 0; + } + } diff --git a/gd-sa3.patch b/gd-sa3.patch new file mode 100644 index 0000000..62ee2ea --- /dev/null +++ b/gd-sa3.patch @@ -0,0 +1,31 @@ +The following issue has been found by Coverity static analysis tool. + +Error: STRING_OVERFLOW (CWE-120): [#def53] +gd-2.0.35/annotate.c:42: cond_false: Condition "argc != 3", taking false branch +gd-2.0.35/annotate.c:60: if_end: End of if statement +gd-2.0.35/annotate.c:64: cond_false: Condition "!in", taking false branch +gd-2.0.35/annotate.c:68: if_end: End of if statement +gd-2.0.35/annotate.c:75: cond_false: Condition "!im", taking false branch +gd-2.0.35/annotate.c:79: if_end: End of if statement +gd-2.0.35/annotate.c:80: cond_true: Condition "fgets(s, 1024 /* sizeof (s) */, stdin)", taking true branch +gd-2.0.35/annotate.c:85: cond_false: Condition "!st", taking false branch +gd-2.0.35/annotate.c:89: if_end: End of if statement +gd-2.0.35/annotate.c:90: cond_true: Condition "!__coverity_strcmp(st, "font")", taking true branch +gd-2.0.35/annotate.c:93: cond_false: Condition "!st", taking false branch +gd-2.0.35/annotate.c:96: if_end: End of if statement +gd-2.0.35/annotate.c:97: fixed_size_dest: You might overrun the 1024 byte fixed-size string "font" by copying "st" without checking the length. + +diff -up gd-2.0.35/annotate.c.sa3 gd-2.0.35/annotate.c +--- gd-2.0.35/annotate.c.sa3 2012-12-05 17:26:21.157729019 +0100 ++++ gd-2.0.35/annotate.c 2012-12-05 17:27:31.762762209 +0100 +@@ -94,6 +94,10 @@ main (int argc, char *argv[]) + { + goto badLine; + } ++ if (strlen(st) >= sizeof(font) - 1) ++ { ++ goto badLine; ++ } + strcpy (font, st); + } + else if (!strcmp (st, "align")) diff --git a/gd-sa4.patch b/gd-sa4.patch new file mode 100644 index 0000000..50d33d0 --- /dev/null +++ b/gd-sa4.patch @@ -0,0 +1,148 @@ +The following issue has been found by Coverity static analysis tool. + +Error: FORWARD_NULL (CWE-476): [#def5] +gd-2.0.35/gd_topal.c:1790: assign_zero: Assigning: "cquantize" = "NULL". +gd-2.0.35/gd_topal.c:1798: cond_false: Condition "cimP", taking false branch +gd-2.0.35/gd_topal.c:1804: else_branch: Reached else branch +gd-2.0.35/gd_topal.c:1807: cond_false: Condition "!oim->trueColor", taking false branch +gd-2.0.35/gd_topal.c:1815: if_end: End of if statement +gd-2.0.35/gd_topal.c:1819: cond_true: Condition "oim->transparent >= 0", taking true branch +gd-2.0.35/gd_topal.c:1823: cond_true: Condition "colorsWanted > maxColors", taking true branch +gd-2.0.35/gd_topal.c:1827: cond_true: Condition "!cimP", taking true branch +gd-2.0.35/gd_topal.c:1829: cond_false: Condition "!nim->pixels", taking false branch +gd-2.0.35/gd_topal.c:1833: if_end: End of if statement +gd-2.0.35/gd_topal.c:1834: cond_true: Condition "i < nim->sy", taking true branch +gd-2.0.35/gd_topal.c:1837: cond_true: Condition "!nim->pixels[i]", taking true branch +gd-2.0.35/gd_topal.c:1839: goto: Jumping to label "outOfMemory" +gd-2.0.35/gd_topal.c:2027: label: Reached label "outOfMemory" +gd-2.0.35/gd_topal.c:2028: cond_true: Condition "oim->trueColor", taking true branch +gd-2.0.35/gd_topal.c:2030: cond_true: Condition "!cimP", taking true branch +gd-2.0.35/gd_topal.c:2032: cond_true: Condition "i < nim->sy", taking true branch +gd-2.0.35/gd_topal.c:2034: cond_true: Condition "nim->pixels[i]", taking true branch +gd-2.0.35/gd_topal.c:2038: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd_topal.c:2032: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd_topal.c:2032: cond_true: Condition "i < nim->sy", taking true branch +gd-2.0.35/gd_topal.c:2034: cond_true: Condition "nim->pixels[i]", taking true branch +gd-2.0.35/gd_topal.c:2038: loop: Jumping back to the beginning of the loop +gd-2.0.35/gd_topal.c:2032: loop_begin: Jumped back to beginning of loop +gd-2.0.35/gd_topal.c:2032: cond_false: Condition "i < nim->sy", taking false branch +gd-2.0.35/gd_topal.c:2038: loop_end: Reached end of loop +gd-2.0.35/gd_topal.c:2039: cond_true: Condition "nim->pixels", taking true branch +gd-2.0.35/gd_topal.c:2044: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gd_topal.c:2047: if_end: End of if statement +gd-2.0.35/gd_topal.c:2050: cond_true: Condition "i < (32 /* 1 << 5 */)", taking true branch +gd-2.0.35/gd_topal.c:2052: var_deref_op: Dereferencing null pointer "cquantize". + +Error: FORWARD_NULL (CWE-476): [#def6] +gd-2.0.35/gd_topal.c:1798: cond_true: Condition "cimP", taking true branch +gd-2.0.35/gd_topal.c:1801: cond_false: Condition "!nim", taking false branch +gd-2.0.35/gd_topal.c:1803: if_end: End of if statement +gd-2.0.35/gd_topal.c:1804: if_fallthrough: Falling through to end of if statement +gd-2.0.35/gd_topal.c:1806: if_end: End of if statement +gd-2.0.35/gd_topal.c:1807: cond_false: Condition "!oim->trueColor", taking false branch +gd-2.0.35/gd_topal.c:1815: if_end: End of if statement +gd-2.0.35/gd_topal.c:1819: cond_true: Condition "oim->transparent >= 0", taking true branch +gd-2.0.35/gd_topal.c:1823: cond_true: Condition "colorsWanted > maxColors", taking true branch +gd-2.0.35/gd_topal.c:1827: cond_false: Condition "!cimP", taking false branch +gd-2.0.35/gd_topal.c:1842: if_end: End of if statement +gd-2.0.35/gd_topal.c:1857: cond_true: Condition "!cquantize", taking true branch +gd-2.0.35/gd_topal.c:1857: var_compare_op: Comparing "cquantize" to null implies that "cquantize" might be null. +gd-2.0.35/gd_topal.c:1860: goto: Jumping to label "outOfMemory" +gd-2.0.35/gd_topal.c:2027: label: Reached label "outOfMemory" +gd-2.0.35/gd_topal.c:2028: cond_true: Condition "oim->trueColor", taking true branch +gd-2.0.35/gd_topal.c:2030: cond_false: Condition "!cimP", taking false branch +gd-2.0.35/gd_topal.c:2044: else_branch: Reached else branch +gd-2.0.35/gd_topal.c:2050: cond_true: Condition "i < (32 /* 1 << 5 */)", taking true branch +gd-2.0.35/gd_topal.c:2052: var_deref_op: Dereferencing null pointer "cquantize". + +Error: FORWARD_NULL (CWE-476): [#def7] +gd-2.0.35/gd_topal.c:1798: cond_false: Condition "cimP", taking false branch +gd-2.0.35/gd_topal.c:1804: else_branch: Reached else branch +gd-2.0.35/gd_topal.c:1807: cond_false: Condition "!oim->trueColor", taking false branch +gd-2.0.35/gd_topal.c:1815: if_end: End of if statement +gd-2.0.35/gd_topal.c:1819: cond_true: Condition "oim->transparent >= 0", taking true branch +gd-2.0.35/gd_topal.c:1823: cond_true: Condition "colorsWanted > maxColors", taking true branch +gd-2.0.35/gd_topal.c:1827: cond_true: Condition "!cimP", taking true branch +gd-2.0.35/gd_topal.c:1829: cond_true: Condition "!nim->pixels", taking true branch +gd-2.0.35/gd_topal.c:1829: var_compare_op: Comparing "nim->pixels" to null implies that "nim->pixels" might be null. +gd-2.0.35/gd_topal.c:1832: goto: Jumping to label "outOfMemory" +gd-2.0.35/gd_topal.c:2027: label: Reached label "outOfMemory" +gd-2.0.35/gd_topal.c:2028: cond_true: Condition "oim->trueColor", taking true branch +gd-2.0.35/gd_topal.c:2030: cond_true: Condition "!cimP", taking true branch +gd-2.0.35/gd_topal.c:2032: cond_true: Condition "i < nim->sy", taking true branch +gd-2.0.35/gd_topal.c:2034: var_deref_op: Dereferencing null pointer "nim->pixels". + + +diff -up gd-2.0.35/gd_topal.c.sa4 gd-2.0.35/gd_topal.c +--- gd-2.0.35/gd_topal.c.sa4 2012-12-10 13:30:19.666363149 +0100 ++++ gd-2.0.35/gd_topal.c 2012-12-10 13:37:50.550729535 +0100 +@@ -2029,15 +2029,15 @@ outOfMemory: + { + if (!cimP) { + /* On failure only */ +- for (i = 0; i < nim->sy; i++) +- { +- if (nim->pixels[i]) +- { +- gdFree (nim->pixels[i]); +- } +- } + if (nim->pixels) + { ++ for (i = 0; i < nim->sy; i++) ++ { ++ if (nim->pixels[i]) ++ { ++ gdFree (nim->pixels[i]); ++ } ++ } + gdFree (nim->pixels); + } + nim->pixels = 0; +@@ -2047,27 +2047,27 @@ outOfMemory: + } + } + success: +- for (i = 0; i < HIST_C0_ELEMS; i++) +- { +- if (cquantize->histogram[i]) +- { +- gdFree (cquantize->histogram[i]); +- } +- } +- if (cquantize->histogram) +- { +- gdFree (cquantize->histogram); +- } +- if (cquantize->fserrors) +- { +- gdFree (cquantize->fserrors); +- } +- if (cquantize->error_limiter_storage) +- { +- gdFree (cquantize->error_limiter_storage); +- } + if (cquantize) + { ++ for (i = 0; i < HIST_C0_ELEMS; i++) ++ { ++ if (cquantize->histogram[i]) ++ { ++ gdFree (cquantize->histogram[i]); ++ } ++ } ++ if (cquantize->histogram) ++ { ++ gdFree (cquantize->histogram); ++ } ++ if (cquantize->fserrors) ++ { ++ gdFree (cquantize->fserrors); ++ } ++ if (cquantize->error_limiter_storage) ++ { ++ gdFree (cquantize->error_limiter_storage); ++ } + gdFree (cquantize); + } + diff --git a/gd.spec b/gd.spec new file mode 100644 index 0000000..9813390 --- /dev/null +++ b/gd.spec @@ -0,0 +1,400 @@ +Summary: A graphics library for quick creation of PNG or JPEG images +Name: gd +Version: 2.0.35 +Release: 24%{?dist} +Group: System Environment/Libraries +License: MIT +URL: http://www.libgd.org/Main_Page +Source0: http://www.libgd.org/releases/%{name}-%{version}.tar.bz2 +Patch0: gd-2.0.33-freetype.patch +Patch3: gd-2.0.34-multilib.patch +Patch4: gd-loop.patch +Patch5: gd-2.0.34-sparc64.patch +Patch6: gd-2.0.35-overflow.patch +Patch7: gd-2.0.35-AALineThick.patch +Patch8: gd-2.0.33-BoxBound.patch +Patch9: gd-2.0.34-fonts.patch +Patch10: gd-2.0.35-time.patch +Patch11: gd-2.0.35-security3.patch +Patch12: gd-2.0.35-runtests.patch +Patch13: gd-sa1.patch +Patch14: gd-sa2.patch +Patch15: gd-sa3.patch +Patch16: gd-sa4.patch +Patch17: gd-aarch64.patch +BuildRequires: freetype-devel, fontconfig-devel, libX11-devel, libXpm-devel +BuildRequires: libjpeg-devel, libpng-devel, zlib-devel, pkgconfig +# we need cmake for building test suite +BuildRequires: cmake, chrpath + +%description +The gd graphics library allows your code to quickly draw images +complete with lines, arcs, text, multiple colors, cut and paste from +other images, and flood fills, and to write out the result as a PNG or +JPEG file. This is particularly useful in Web applications, where PNG +and JPEG are two of the formats accepted for inline images by most +browsers. Note that gd is not a paint program. + + +%package progs +Requires: gd = %{version}-%{release} +Summary: Utility programs that use libgd +Group: Applications/Multimedia + +%description progs +The gd-progs package includes utility programs supplied with gd, a +graphics library for creating PNG and JPEG images. + + +%package devel +Summary: The development libraries and header files for gd +Group: Development/Libraries +Requires: gd = %{version}-%{release} +Requires: libX11-devel, libXpm-devel, libjpeg-devel, freetype-devel +Requires: libpng-devel, zlib-devel, fontconfig-devel +Requires: pkgconfig + +%description devel +The gd-devel package contains the development libraries and header +files for gd, a graphics library for creating PNG and JPEG graphics. + +%prep +%setup -q +%patch0 -p1 -b .freetype +%patch3 -p1 -b .mlib +%patch4 -p1 -b .loop +%patch6 -p1 -b .overflow +%patch5 -p1 -b .sparc64 +%patch7 -p1 -b .AALineThick +%patch8 -p1 -b .bb +%patch9 -p1 -b .fonts +%patch10 -p1 -b .time +%patch11 -p1 -b .sec3 +%patch12 -p1 -b .runtests +%patch13 -p1 -b .sa1 +%patch14 -p1 -b .sa2 +%patch15 -p1 -b .sa3 +%patch16 -p1 -b .sa4 +%patch17 -p1 -b .aarch64 + +%build +%configure --disable-rpath +make %{?_smp_mflags} + +%install +make install INSTALL='install -p' DESTDIR=$RPM_BUILD_ROOT +rm -f $RPM_BUILD_ROOT/%{_libdir}/libgd.la +rm -f $RPM_BUILD_ROOT/%{_libdir}/libgd.a + +# Using the last resort to remove rpath, another tricks didn't help +chrpath --delete $RPM_BUILD_ROOT%{_bindir}/{pngtogd,gdparttopng,annotate,gdcmpgif,gdtopng,webpng,pngtogd2,gd2togif,gd2copypal,giftogd2,gd2topng} + +%check +pushd tests +cmake -DBUILD_TEST=1 \ + -DGD_INCLUDE_DIR="`pwd`/.." \ + -DGD_LIBS_DIR="`pwd`/../.libs" \ + -DGD_SOURCE_DIR="`pwd`/.." . +CPATH="`pwd`/gdtest" make +make test +popd + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%doc COPYING README-JPEG.TXT index.html NEWS +%{_libdir}/*.so.* + +%files progs +%{_bindir}/* +%exclude %{_bindir}/gdlib-config + +%files devel +%doc index.html +%{_bindir}/gdlib-config +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/pkgconfig/gdlib.pc + +%changelog +* Mon Mar 25 2013 Honza Horak - 2.0.35-24 +- Fix build on aarch64 + +* Mon Mar 25 2013 Honza Horak - 2.0.35-23 +- Fix issues found by Coverity + +* Wed Feb 13 2013 Fedora Release Engineering - 2.0.35-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Fri Jan 18 2013 Adam Tkac - 2.0.35-21 +- rebuild due to "jpeg8-ABI" feature drop + +* Fri Dec 21 2012 Adam Tkac - 2.0.35-20 +- rebuild against new libjpeg + +* Tue Aug 28 2012 Honza Horak - 2.0.35-19 +- Spec file cleanup +- Compile and run test suite during build +- Using chrpath to get rid of --rpath in gd-progs + +* Fri Jul 27 2012 Fedora Release Engineering - 2.0.35-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jun 11 2012 Honza Horak - 2.0.35-17 +- fixed CVE-2009-3546 gd: insufficient input validation in _gdGetColors() + Resolves: #830745 + +* Tue Feb 28 2012 Honza Horak - 2.0.35-16 +- Fixed AALineThick.patch to display vertical lines correctly + Resolves: #798255 + +* Fri Jan 13 2012 Fedora Release Engineering - 2.0.35-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Nov 08 2011 Adam Jackson 2.0.35-14 +- Rebuild for libpng 1.5 + +* Wed Oct 26 2011 Fedora Release Engineering - 2.0.35-13 +- Rebuilt for glibc bug#747377 + +* Tue Feb 08 2011 Fedora Release Engineering - 2.0.35-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Jan 6 2010 Jiri Moskovcak - 2.0.35-11 +- more spec file fixes + +* Wed Jan 6 2010 Jiri Moskovcak - 2.0.35-10 +- spec file fixes based on merge review + +* Fri Jul 24 2009 Fedora Release Engineering - 2.0.35-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Feb 24 2009 Fedora Release Engineering - 2.0.35-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Jan 6 2009 Ivana Varekova - 2.0.35-7 +- do minor spec file cleanup + +* Mon Jul 21 2008 Tom "spot" Callaway - 2.0.35-6 +- fix license tag (nothing in this is GPL) + +* Tue Feb 19 2008 Fedora Release Engineering - 2.0.35-5 +- Autorebuild for GCC 4.3 + +* Tue Nov 20 2007 Ivana Varekova 2.0.35-4 +- remove static library + +* Mon Nov 19 2007 Ivana Varekova 2.0.35-3 +- spec file cleanup + +* Mon Nov 19 2007 Ivana Varekova 2.0.35-2 +- fix gdlib.pc file + +* Tue Sep 18 2007 Ivana Varekova 2.0.35-1 +- update to 2.0.35 + +* Tue Sep 4 2007 Ivana Varekova 2.0.34-3 +- fix font paths (#225786#5) +- fix pkgconfig Libs flag (#225786#4) + +* Thu Feb 22 2007 Ivana Varekova 2.0.34-2 +- incorporate package review feedback + +* Thu Feb 8 2007 Ivana Varekova 2.0.34-1 +- update to 2.0.34 + +* Mon Jan 29 2007 Ivana Varekova 2.0.33-12 +- Resolves: #224610 + CVE-2007-0455 gd buffer overrun + +* Tue Nov 21 2006 Ivana Varekova 2.0.33-11 +- Fix problem with to large box boundaries + Resolves: #197747 + +* Thu Nov 16 2006 Ivana Varekova 2.0.33-10 +- added 'thick' - variable support for AA line (#198042) + +* Tue Oct 31 2006 Adam Tkac 2.0.33-9.4 +- patched some additionals overflows in gd (#175414) + +* Wed Sep 13 2006 Jitka Kudrnacova - 2.0.33 - 9.3 +- gd-devel now requires fontconfig-devel (#205834) + +* Wed Jul 19 2006 Jitka Kudrnacova - 2.0.33 - 9.2 +- use CFLAGS on sparc64 (#199363) + +* Wed Jul 12 2006 Jesse Keating - 2.0.33 - 9.1 +- rebuild + +* Mon Jul 10 2006 Jitka Kudrnacova 2.0.33-9 +- prevent from an infinite loop when decoding bad GIF images (#194520) + +* Thu May 25 2006 Ivana Varekova - 2.0.33-7 +- fix multilib problem (add pkgconfig) + +* Fri Feb 10 2006 Jesse Keating - 2.0.33-6.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 2.0.33-6.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Jan 20 2006 Phil Knirsch 2.0.33-6 +- Included a few more overflow checks (#177907) + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Wed Nov 02 2005 Phil Knirsch 2.0.33-5 +- Switched BuildPreReqs and Requires to modular xorg-x11 style + +* Mon Oct 10 2005 Phil Knirsch 2.0.33-4 +- Fixed possible gd crash when drawing AA line near image borders (#167843) + +* Wed Sep 07 2005 Phil Knirsch 2.0.33-3 +- Fixed broken freetype-config --libs flags in configure (#165875) + +* Sun Apr 17 2005 Warren Togami 2.0.33-2 +- devel reqs (#155183 thias) + +* Tue Mar 22 2005 Than Ngo 2.0.33-1 +- 2.0.33 #150717 +- apply the patch from Jose Pedro Oliveira + - Added the release macro to the subpackages requirements versioning + - Handled the gdlib-config movement to gd-devel in a differment manner + - Added fontconfig-devel to the build requirements + - Added xorg-x11-devel to the build requirements (Xpm) + - Removed explicit /sbin/ldconfig requirement (gd rpm) + - Removed explicit perl requirement (gd-progs rpm) + - Added several missing documentation files (including the license file) + - Replaced %%makeinstall by make install DESTDIR=... + +* Thu Mar 10 2005 Than Ngo 2.0.32-3 +- move gdlib-config in devel + +* Wed Mar 02 2005 Phil Knirsch 2.0.32-2 +- bump release and rebuild with gcc 4 + +* Wed Nov 03 2004 Phil Knirsch 2.0.32-1 +- Update to 2.0.32 which includes all the security fixes + +* Wed Oct 27 2004 Phil Knirsch 2.0.28-2 +- Fixed several buffer overflows for gdMalloc() calls + +* Tue Jul 27 2004 Phil Knirsch 2.0.28-1 +- Update to 2.0.28 + +* Fri Jul 02 2004 Phil Knirsch 2.0.27-1 +- Updated to 2.0.27 due to: + o Potential memory overruns in gdImageFilledPolygon. Thanks to John Ellson. + o The sign of Y-axis values returned in the bounding box by gdImageStringFT + was incorrect. Thanks to John Ellson and Riccardo Cohen. + +* Wed Jun 30 2004 Phil Knirsch 2.0.26-1 +- Update to 2.0.26 + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Wed Apr 21 2004 Phil Knirsch 2.0.21-3 +- Disable rpath usage. + +* Tue Mar 02 2004 Elliot Lee +- rebuilt + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Mon Feb 02 2004 Phil Knirsch 2.0.21-1 +- Updated to 2.0.21 + +* Tue Aug 12 2003 Florian La Roche +- update to 2.0.15 + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Tue May 06 2003 Phil Knirsch 2.0.12-1 +- Update to 2.0.12 + +* Wed Jan 22 2003 Tim Powers 1.8.4-11 +- rebuilt + +* Wed Dec 11 2002 Tim Powers 1.8.4-10 +- rebuild on all arches + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Thu May 23 2002 Tim Powers +- automated rebuild + +* Thu Jan 24 2002 Phil Knirsch +- Specfile update to add URL for homepage (#54608) + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Wed Oct 31 2001 Bernhard Rosenkraenzer 1.8.4-5 +- Rebuild with current libpng + +* Mon Aug 13 2001 Philipp Knirsch 1.8.4-4 +- Fixed a wrong double ownership of libgd.so (#51599). + +* Fri Jul 20 2001 Bernhard Rosenkraenzer 1.8.4-3 +- There's really no reason to link against both freetype 1.x and 2.x, + especially when gd is configured to use just freetype 2.x. ;) + +* Mon Jun 25 2001 Philipp Knirsch +- Forgot to include the freetype library in the shared library linking. Fixed. + +* Thu Jun 21 2001 Philipp Knirsch +- Update to 1.8.4 + +* Tue Dec 19 2000 Philipp Knirsch +- Updates the descriptions to get rid of al references to gif + +* Tue Dec 12 2000 Philipp Knirsch +- Fixed bug #22001 where during installation the .so.1 and the so.1.8 links + didn't get installed and therefore updates had problems. + +* Wed Oct 4 2000 Nalin Dahyabhai +- define HAVE_LIBTTF to actually enable ttf support (oops, #18299) +- remove explicit dependencies on libpng, libjpeg, et. al. +- add BuildPrereq: freetype-devel + +* Wed Aug 2 2000 Matt Wilson +- rebuilt against new libpng + +* Mon Jul 31 2000 Nalin Dahyabhai +- add %%postun run of ldconfig (#14915) + +* Thu Jul 13 2000 Prospector +- automatic rebuild + +* Tue Jun 27 2000 Nalin Dahyabhai +- update to 1.8.3 + +* Sat Jun 4 2000 Nalin Dahyabhai +- rebuild in new environment + +* Mon May 22 2000 Nalin Dahyabhai +- break out a -progs subpackage +- disable freetype support + +* Fri May 19 2000 Nalin Dahyabhai +- update to latest version (1.8.2) +- disable xpm support + +* Thu Feb 03 2000 Nalin Dahyabhai +- auto rebuild in the new build environment (release 6) + +* Sun Mar 21 1999 Cristian Gafton +- auto rebuild in the new build environment (release 5) + +* Thu Dec 17 1998 Cristian Gafton +- buiuld for glibc 2.1 + +* Fri Sep 11 1998 Cristian Gafton +- built for 5.2 -- cgit