--- flac-1.1.4.orig/config.sub +++ flac-1.1.4/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. -timestamp='2003-06-18' +timestamp='2007-01-18' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +22,15 @@ # # 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., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,7 +72,7 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -83,11 +85,11 @@ while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +101,7 @@ *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,7 +120,9 @@ # 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* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -144,7 +148,7 @@ -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) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -169,6 +173,10 @@ -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -185,6 +193,10 @@ # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -228,14 +240,17 @@ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -244,28 +259,33 @@ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | mt \ | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | s390 | s390x \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ - | strongarm \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -276,6 +296,9 @@ ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -295,20 +318,20 @@ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | 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-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -317,31 +340,36 @@ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | s390-* | s390x-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; @@ -361,6 +389,9 @@ basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -378,6 +409,9 @@ amd64) basic_machine=x86_64-pc ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -437,12 +471,27 @@ basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -465,6 +514,10 @@ basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -643,10 +696,6 @@ mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -659,6 +708,9 @@ basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -727,10 +779,6 @@ np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -738,9 +786,12 @@ basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson @@ -767,6 +818,12 @@ pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -823,6 +880,10 @@ basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -833,6 +894,12 @@ rtpc | rtpc-*) basic_machine=romp-ibm ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; sa29200) basic_machine=a29k-amd os=-udi @@ -843,6 +910,10 @@ sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -854,6 +925,9 @@ basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -956,6 +1030,10 @@ tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -999,6 +1077,10 @@ basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1029,6 +1111,9 @@ romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1045,13 +1130,10 @@ we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1124,19 +1206,23 @@ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -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* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1154,12 +1240,15 @@ os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1172,6 +1261,9 @@ -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1193,6 +1285,9 @@ -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1215,6 +1310,9 @@ -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1251,6 +1349,9 @@ -kaos*) os=-kaos ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) @@ -1273,6 +1374,12 @@ # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1282,8 +1389,8 @@ arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1310,6 +1417,9 @@ m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1328,9 +1438,15 @@ *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1463,9 +1579,15 @@ -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; @@ -1490,7 +1612,7 @@ esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) --- flac-1.1.4.orig/config.guess +++ flac-1.1.4/config.guess @@ -1,9 +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 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. -timestamp='2003-06-17' +timestamp='2007-03-06' # 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,13 +18,15 @@ # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # 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. @@ -53,7 +56,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -66,11 +69,11 @@ while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -104,7 +107,7 @@ trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; @@ -123,7 +126,7 @@ ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -136,13 +139,6 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -## for Red Hat Linux -if test -f /etc/redhat-release ; then - VENDOR=redhat ; -else - VENDOR= ; -fi - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -165,6 +161,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 @@ -203,50 +200,32 @@ # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU @@ -284,42 +263,49 @@ "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # 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/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; 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 # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -327,32 +313,32 @@ else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -361,10 +347,10 @@ esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -376,10 +362,10 @@ echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -390,37 +376,40 @@ # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -444,32 +433,33 @@ exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -485,29 +475,29 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -515,7 +505,7 @@ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -530,14 +520,18 @@ exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) 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 @@ -551,28 +545,28 @@ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -634,9 +628,19 @@ esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -644,11 +648,11 @@ fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -676,150 +680,182 @@ exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + 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 0 ;; + 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}" + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) + exit ;; + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-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 0 ;; + 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 # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu - exit 0 ;; + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -836,8 +872,12 @@ #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -855,15 +895,22 @@ #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) - echo powerpc-${VENDOR:-unknown}-linux-gnu - exit 0 ;; + echo powerpc-unknown-linux-gnu + exit ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR:-unknown}-linux-gnu - exit 0 ;; + echo powerpc64-unknown-linux-gnu + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -877,7 +924,7 @@ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -885,25 +932,31 @@ PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-ibm-linux + exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR:-unknown}-linux-gnu - exit 0 ;; + echo x86_64-unknown-linux-gnu + exit ;; + xtensa:Linux:*:*) + echo xtensa-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 @@ -921,15 +974,15 @@ ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -946,23 +999,33 @@ LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #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 | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR:-pc}-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + 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 # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + 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... @@ -970,24 +1033,27 @@ # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -995,15 +1061,16 @@ else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' 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 0 + && { 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 0 ;; + && { 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 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1095,68 +1162,81 @@ else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + 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 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1164,22 +1244,25 @@ UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1190,28 +1273,47 @@ UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1243,7 +1345,7 @@ #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1332,11 +1434,12 @@ } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1345,22 +1448,22 @@ case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1371,7 +1474,9 @@ the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be --- flac-1.1.4.orig/debian/changelog +++ flac-1.1.4/debian/changelog @@ -0,0 +1,518 @@ +flac (1.1.4-3ubuntu1.1) gutsy-security; urgency=low + + * SECURITY UPDATE: multiple integer overflows resulting in heap-based + buffer overflows and potential remote code execution + * debian/patches/08_SECURITY_CVE-2007-4619.dpatch: perform proper bounds + checking, create safe memory allocation functions in alloc.h, and adjust + source files to use these safe memory routines. + * References + CVE-2007-4619 + + -- Jamie Strandboge Tue, 23 Oct 2007 21:00:18 +0000 + +flac (1.1.4-3ubuntu1) gutsy; urgency=low + + * debian/control: xmms-dev dropped to allow xmms to move to universe, + adjust maintainer field. + + -- Kees Cook Thu, 21 Jun 2007 13:52:55 -0700 + +flac (1.1.4-3) unstable; urgency=low + + * The "It's Never Too Late to Mend" release. + * Finally, since liboggflac and libflac have been merged, make libflac-dev + depend on libogg-dev. closes: #427742 + + -- Joshua Kwan Wed, 06 Jun 2007 08:32:47 -0700 + +flac (1.1.4-2) unstable; urgency=low + + * Provide flac.pc and flac++.pc. closes: #427651 + * Fix typo in libFLAC.m4 that messes up LD_LIBRARY_PATH by mistake if it's + previously set. closes: #427473 + * Correct path to documentation. closes: #413411 + * Updated ${Source-Version} usage to ${binary:Version} all around. + + -- Joshua Kwan Wed, 06 Jun 2007 01:09:18 -0700 + +flac (1.1.4-1) unstable; urgency=low + + * New upstream release. closes: #405167, #411311 + - libOggFLAC and libOggFLAC++ have been merged into libFLAC, so + remove their corresponding packages. + - Because of the API changes required to effect the above, there has + been yet another soname bump. libflac7 -> libflac8 and + libflac++5 -> libflac++6. Emails have been dispatched to the + maintainers of dependent packages. + * Some notes on patches that were removed: + - 02_stdin_stdout, 06_manpage_mention_utf8_convert: merged upstream + - 08_manpage_warnings: Upstream has changed the manpage so it defintely + can't fit in in 80 cols, so just forget about it. We'll live. + - 05_eof_warnings_are_errors: Upstream decided to add a -w option to + flac to treat all warnings as errors. I am going to defer to that + for now, but if people think it's stupid let me know and I'll port + the patch forward. + - 04_stack_smasher: was a backport from 1.1.3, so it's obsolete. + + -- Joshua Kwan Tue, 29 May 2007 22:56:36 -0700 + +flac (1.1.2-6) unstable; urgency=high + + * Update 04_stack_smasher.dpatch, a more complete fix backported from + 1.1.3. This should fix the XMMS crash issue, thanks Jan Luebbe. + closes: #401774 + + -- Joshua Kwan Fri, 12 Jan 2007 01:12:14 -0800 + +flac (1.1.2-5) unstable; urgency=low + + * Add description for --no-utf8-convert option in metaflac.1. + closes: #345785 + * Don't exit 0 when a wrong option to flac is entered. closes: #329979 + + -- Joshua Kwan Sat, 27 May 2006 23:07:10 -0600 + +flac (1.1.2-4) unstable; urgency=low + + * Acknowledge NMU, now that it's snugly in testing. closes: #340960 + * Fix the watch file. + * Make symlinks for /usr/lib/bmp in xmms-flac to 'provide' bmp-flac, + since input plugins between the two players are interchangeable. + closes: #327108, #356788 + * Bump Standards-Version. + * Fix a goof in the rules that prevented ldconfig from happening in the + postinst of all the library packages. + + -- Joshua Kwan Tue, 23 May 2006 21:17:41 -0700 + +flac (1.1.2-3.1) unstable; urgency=high + + * Non-maintainer upload. + * Turn EOF warnings into errors (Closes: #340960). + + -- Luk Claes Tue, 28 Feb 2006 23:28:02 +0100 + +flac (1.1.2-3) unstable; urgency=medium + + * Brown paper bag release. + * Patch work: + - 03_cosmetic_flac_stats.dpatch: It actually did mess with some features. + Add *one* conditional to fix the bug. Thanks Rodney Gordon II + for helping debug. closes: #325078 + + -- Joshua Kwan Sat, 27 Aug 2005 00:09:06 -0700 + +flac (1.1.2-2) unstable; urgency=medium + + * The "GO BEARS" release + * Patch work: + - 04_stack_smasher.dpatch: Fix a really dumb stack smasher that's been + fixed in CVS for several months but a maintenance release hasn't been + made for. closes: #324783 + + -- Joshua Kwan Wed, 24 Aug 2005 00:20:17 -0700 + +flac (1.1.2-1) unstable; urgency=low + + * New maintainer. + * Acknowledge NMU, thanks Steve; closes: #319235 + * New upstream release, closes: #297331 + * Clean up all the Conflicts/Replaces that no longer apply at all. + * Remove dependencies on debconf. + * Move documentation to new package libflac-doc, closes: #212645, #289737 + * Tighten libid3-3.8.3-dev dependencies because of C++ transition. Just + in case. + * SONAMEs once again changed upstream, rebuild your packages! + By virtue of being a SONAME change, this upload invalidates and thus + closes: #301037, #297964, #298035 + - libflac6 -> libflac7 + - liboggflac1 -> liboggflac3 + - libflac++4c2 -> libflac++5 + - liboggflac++0c2 -> liboggflac++2 + * Patch work (now using dpatch): + - 01_relibtoolize.dpatch: Autotools Suck. + - 02_stdin_stdout.dpatch: Fix a reference in documentation to 'stdin' that + really means 'stdout', thanks dann frazier. closes: #207084 + - 03_cosmetic_flac_stats.dpatch: Fix progress display with long filenames + (Not intensively tested, but never fear: no actual features were harmed + in the development of this bugfix.) closes: #138828 + * Bump Standards-Version to 3.6.2, no changes necessary. + * Bump debhelper compatibility level to 4 and use debian/compat instead + of DH_COMPAT. + * Amend the description of flac to mention metaflac as well as flac. + + -- Joshua Kwan Thu, 18 Aug 2005 02:53:09 -0700 + +flac (1.1.1-5) unstable; urgency=low + + * libflac++4 Conflicts: libflac++2c102 (= 1.1.1-1) for the same reasons + as in 1.1.1-3 (Closes: #290353) + + -- Matt Zimmerman Fri, 14 Jan 2005 09:37:44 -0800 + +flac (1.1.1-4) unstable; urgency=low + + * Re-libtoolize to fix various build weirdnesses and a broken xmms-flac + on amd64 (Closes: #289243) + + -- Matt Zimmerman Sat, 8 Jan 2005 15:08:22 -0800 + +flac (1.1.1-3) unstable; urgency=low + + * libflac6 conflicts with the broken version of libflac4 (Closes: #289077) + * Disable asm optimizations on powerpc, fixing FTBFS (Closes: #289130) + - Apply patch from Eric Wong to fix compilation when asm + optimizations are disabled + * Update to new package names in argument to dh_shlibdeps -l + + -- Matt Zimmerman Thu, 6 Jan 2005 20:23:08 -0800 + +flac (1.1.1-2) unstable; urgency=low + + * Fix -dev dependencies for soname transition (oops) + + -- Matt Zimmerman Wed, 5 Jan 2005 10:13:34 -0800 + +flac (1.1.1-1) unstable; urgency=low + + * New upstream release (Closes: #275324) + - Merges all of our patches to common code + - Fixes handling of long filenames (Closes: #213172) + - Properly quotes AM_PATH_LIBFLAC (Closes: #254127) + - Uses a much newer version of autotools (Closes: #263837) + - Should fix problems with 8-bit audio samples (Closes: #179764) + - Fixes segfault on some invalid files (Closes: #274301) + - Fixes problems with very long files (Closes: #200435) + - Fixes FLAC__STREAM_ENCODER_NOT_STREAMABLE error (Closes: #196556) + - Man page is improved (Closes: #196812) + + -- Matt Zimmerman Wed, 5 Jan 2005 08:29:18 -0800 + +flac (1.1.0-11) unstable; urgency=low + + * Ensure that libFLAC is linked with -lm on all architectures, and + regardless of whether nasm is present + + -- Matt Zimmerman Fri, 16 Apr 2004 15:14:31 -0700 + +flac (1.1.0-10) unstable; urgency=low + + * Touch man/flac.1, to avoid trying to build it even if the timestamp is + skewed (Closes: #203580) + + -- Matt Zimmerman Wed, 30 Jul 2003 22:41:51 -0400 + +flac (1.1.0-9) unstable; urgency=low + + * Re-run automake so that the fix for #202694 actually takes effect + (why is this working for me on i386 every time?) + + -- Matt Zimmerman Tue, 29 Jul 2003 19:53:17 -0400 + +flac (1.1.0-8) unstable; urgency=low + + * Pregenerate the flac.1 man page (Closes: #203024) + + -- Matt Zimmerman Tue, 29 Jul 2003 08:13:50 -0400 + +flac (1.1.0-7) unstable; urgency=low + + * Link flac itself with -lm, in addition to libFLAC (why did this work + for me?) (Closes: #202964) + + -- Matt Zimmerman Sat, 26 Jul 2003 11:58:14 -0400 + +flac (1.1.0-6) unstable; urgency=low + + * Run automake so that library linking changes take effect. + (Closes: #194718) + + -- Matt Zimmerman Sat, 26 Jul 2003 00:09:32 -0400 + +flac (1.1.0-5) unstable; urgency=low + + * Long-overdue policy check + - Build with -g always, and omit -O2 for debug builds + - Pull in changes from upstream CVS to link all shared libraries + against dependent libraries (Closes: #194718) + - Standards-Version: 3.6.0 + + -- Matt Zimmerman Thu, 17 Jul 2003 22:43:01 -0400 + +flac (1.1.0-4) unstable; urgency=low + + * Clean up diff + * Move -dev packages to Section: libdevel + * Build-Depend on libid3-3.8.3-dev (Closes: #196285) + + -- Matt Zimmerman Sat, 7 Jun 2003 00:54:50 -0400 + +flac (1.1.0-3) unstable; urgency=low + + * Build various libraries used in the build tree using libtool rather + than plain .a archives, in order to get PIC code for linking into + shared libraries (Closes: #179434) + * Metaflac manpage was included upstream in 1.1.0 (Closes: #170598) + * Versioned build-dependency on nasm was added in 1.1.0-1 + (Closes: #175944) + * 1.1.0 was uploaded (Closes: #178620) + + -- Matt Zimmerman Sun, 2 Feb 2003 18:02:34 -0500 + +flac (1.1.0-2) unstable; urgency=low + + * Clean up -dev package dependencies + - libflac++-dev depends: libflac-dev (Closes: #179422) + - liboggflac-dev depends: libflac-dev + - liboggflac++-dev depends: liboggflac-dev, libflac++-dev + + -- Matt Zimmerman Sun, 2 Feb 2003 01:32:28 -0500 + +flac (1.1.0-1) unstable; urgency=low + + * New upstream release + * liboggflac0 -> liboggflac1 + * liboggflac1 unfortunately conflicts with liboggflac0 due to an + accidental file overlap + + -- Matt Zimmerman Fri, 31 Jan 2003 16:26:37 -0500 + +flac (1.0.4-5) unstable; urgency=low + + * Build with g++ 3.2 + * Build-depends: g++ (>= 2:3.2) + * libflac++2 -> libflac++2c102 + * liboggflac++0 -> liboggflac++0c102 + + -- Matt Zimmerman Tue, 7 Jan 2003 20:26:25 -0500 + +flac (1.0.4-4) unstable; urgency=low + + * Build libplugin-common as PIC (Closes: #162718) + * Remove libflac-dev's relation with itself (thanks, lintian) + + -- Matt Zimmerman Sun, 17 Nov 2002 01:34:23 -0500 + +flac (1.0.4-3) unstable; urgency=low + + * A file which belonged in libflac-dev ended up in flac 1.0.4-1, so + libflac-dev Replaces: libflac-dev (= 1.0.4-1) (Closes: #163847) + + -- Matt Zimmerman Tue, 8 Oct 2002 16:39:28 -0400 + +flac (1.0.4-2) unstable; urgency=medium + + * Fix libflac and libflac++ shared library package names, which were + invalidated by an unexpected soname change (Closes: #162907) + * Split liboggflac and liboggflac++ into separate packages + + -- Matt Zimmerman Sat, 5 Oct 2002 22:42:56 -0400 + +flac (1.0.4-1) unstable; urgency=low + + * New upstream release + + -- Matt Zimmerman Thu, 26 Sep 2002 10:32:24 -0400 + +flac (1.0.3-3) unstable; urgency=low + + * Tidy up installation of documentation (Closes: #159676) + + -- Matt Zimmerman Thu, 5 Sep 2002 08:15:58 -0400 + +flac (1.0.3-2) unstable; urgency=low + + * Change libflac++-dev to Section: devel + + -- Matt Zimmerman Sat, 13 Jul 2002 11:45:28 -0400 + +flac (1.0.3-1) unstable; urgency=low + + * New upstream release + + -- Matt Zimmerman Thu, 4 Jul 2002 20:14:59 -0400 + +flac (1.0.2+1.0.3beta-1) experimental; urgency=low + + * New upstream pre-release + * Now provides a C++ library as well + * Use dh_makeshlibs to create shlibs control files + + -- Matt Zimmerman Sat, 15 Jun 2002 11:59:46 -0400 + +flac (1.0.2-1) unstable; urgency=low + + * New upstream release. + * Fixes a bug which crashed the input plugins after playing a few files + (Closes: #123210) + * Fixes issues with the assembler optimizations, so that they can be + re-enabled for better performance on i386 + + -- Matt Zimmerman Mon, 10 Dec 2001 03:09:22 -0500 + +flac (1.0.1-2) unstable; urgency=low + + * Pre-generate man page, since something has changed upstream (Closes: + #120463) + + -- Matt Zimmerman Wed, 21 Nov 2001 14:19:29 -0500 + +flac (1.0.1-1) unstable; urgency=low + + * New upstream release. + * Raw encoding bug is fixed upstream (Closes: #119396) + * Manpage is fixed upstream (Closes: #107207) + + -- Matt Zimmerman Mon, 19 Nov 2001 15:33:42 -0500 + +flac (1.0-3) unstable; urgency=low + + * Tighten build-dependency on debconf, since we use DH_COMPAT=3 + (Closes: #115663) + * Disable assembler optimizations, as they seem to cause problems on + some systems. + + -- Matt Zimmerman Tue, 16 Oct 2001 07:38:13 -0400 + +flac (1.0-2) unstable; urgency=low + + * Fix shlibs file (it was trying to use a substitution variable) + (Closes: #107614) + + -- Matt Zimmerman Fri, 3 Aug 2001 16:54:20 -0400 + +flac (1.0-1) unstable; urgency=low + + * New upstream version. + * debian/control: Upstream now ships our man page, so there's no need to + build-depend on docbook-to-man. Build-dependency removed. + * debian/rules: Let upstream makefiles install headers and man page + * debian/control: Upstream library soname version has changed, modified + accordingly + * debian/rules: shlibs hackery is apparently no longer necessary, as + dpkg-shlibdeps will find shlibs files in package/DEBIAN + * Build-Depend on nasm on i386 to take advantage of optimized assembly + routines + * debian/rules, debian/control: Move the .la libtool widget from the + runtime package to the development package, and add Replaces + * ltmain.sh: Hack up to get things to work with libtool 1.4 + + * debian/rules: DH_COMPAT=3 + + -- Matt Zimmerman Wed, 25 Jul 2001 15:57:29 -0400 + +flac (0.10-2) unstable; urgency=low + + * Fix a build error with the xmms plugin that resulted in a broken + xmms-flac. Patch forwarded upstream. (Closes: #101827) + + -- Matt Zimmerman Thu, 21 Jun 2001 15:43:39 -0400 + +flac (0.10-1) unstable; urgency=low + + * New upstream version. + + -- Matt Zimmerman Thu, 14 Jun 2001 16:05:29 -0400 + +flac (0.9-1) unstable; urgency=low + + * New upstream version. + * From the upstream changelog: + * FLAC 0.9 released. There were some format changes that broke backwards + compatibility but these should be the last (see below). Also, there have + been several bug fixes and some new features: + + FLAC's sync code has been lengthened to 14 bits from 9 bits. This + should enable a faster and more robust synchronization mechanism. + + Two reserved bits were added to the frame header. + + A CRC-16 was added to the FLAC frame footer, and the decoder now does + frame integrity checking based on the CRC. + + The format now includes a new subframe field to indicate when a + subblock has one or more 0 LSBs for all samples. This increases + compression on some kinds of data. + + Added two options to the analysis mode, one for including the residual + signal in the analysis file, and one for generating gnuplot files of + each subframe's residual distribution with some statistics. See the + latest documentation. + + XMMS plugin now supports 8-bit files. + FLAC is on track for an official 1.0 release soon. + + -- Matt Zimmerman Fri, 6 Apr 2001 07:41:30 -0400 + +flac (0.8-1) unstable; urgency=low + + * New upstream version. + * From the upstream changelog: + * This release is a result of extensive testing and fixes several bugs + encountered when pushing the encoder to the limit. I'm pretty + confident in the stability of the encoder/decoder now for all kinds of + input. There have also been several features added. Here is a complete + list of the changes since 0.7: + + Created a new utility called metaflac. It is a metadata editor for + .flac files. Right now it just lists the contents of the metadata + blocks but eventually it will allow update/insertion/deletion. + + Added two new metadata blocks: PADDING which has an obvious function, + and APPLICATION, which is meant to be open to third party applications. + See the latest format docs for more info, or the new id registration + page. + + Added a -P option to flac to reserve a PADDING block when encoding. + + Added support for 24-bit files to flac (the FLAC format always + supported it). + + Started the Winamp3 plugin. + + Greatly expanded the test suite, adding more streams (24-bit streams, + noise streams, non-audio streams, more patterns) and more option + combinations to the encoder. The test suite runs about 30 streams and + over 5000 encodings now. + * This version includes a patch to configure.in from upstream CVS (an + omitted AC_OUTPUT file). + + -- Matt Zimmerman Fri, 9 Mar 2001 03:58:56 -0500 + +flac (0.7-1) unstable; urgency=low + + * New upstream version. + * Note that this version contains a known bug that, according to the + author, is revealed when encoding more than 2 channels using a large + blocksize (>32k samples). See + http://flac.sourceforge.net/news.html#20010212 for more information. + + -- Matt Zimmerman Fri, 23 Feb 2001 01:14:10 -0500 + +flac (0.6-2) unstable; urgency=low + + * Display a note about backward compatibility + * Warn users of pre-0.6 versions about upgrading, as 0.6 cannot read + files encoded with previous versions (Closes: #84630) + + -- Matt Zimmerman Sat, 3 Feb 2001 20:46:22 -0500 + +flac (0.6-1) unstable; urgency=low + + * New upstream version: + - encoding speed in default mode (-6) is at least 3x faster + - a new "loose mid-side" adaptive algorithm should help -1 and -5 modes + - a new analyze mode for developers + - bug fixes related to pipes + * Our automake patches have been incorporated upstream, so we no longer + need them in the Debian diff + * Added manpage for flac + * Run ldconfig in postinst (oops) + * Cleaned up debian/ directory + + -- Matt Zimmerman Mon, 29 Jan 2001 14:50:11 -0500 + +flac (0.5-2) unstable; urgency=low + + * Fixed binary package sections to match override file (oops) + * debian/rules: Set execute permissions on autoconf scripts created in the + debian diff (Closes: #83105) + * Honor DEB_BUILD_OPTIONS (nostrip, debug) + + -- Matt Zimmerman Mon, 22 Jan 2001 14:57:31 -0500 + +flac (0.5-1) unstable; urgency=low + + * Initial Release. + + -- Matt Zimmerman Wed, 17 Jan 2001 14:52:43 -0500 + + --- flac-1.1.4.orig/debian/libflac-dev.install +++ flac-1.1.4/debian/libflac-dev.install @@ -0,0 +1,6 @@ +usr/lib/libFLAC.a +usr/lib/libFLAC.so +usr/lib/libFLAC.la +usr/include/FLAC +usr/lib/pkgconfig/flac.pc +usr/share/aclocal/libFLAC.m4 --- flac-1.1.4.orig/debian/libflac++6.install +++ flac-1.1.4/debian/libflac++6.install @@ -0,0 +1 @@ +usr/lib/libFLAC++.so.* --- flac-1.1.4.orig/debian/libflac-doc.doc-base.api +++ flac-1.1.4/debian/libflac-doc.doc-base.api @@ -0,0 +1,10 @@ +Document: libflac-doc-api +Title: FLAC Library API Reference +Author: Josh Coalson +Abstract: This is the online API reference for the libFLAC, libFLAC++, + libOggFLAC, and libOggFLAC++ libraries, generated by Doxygen. +Section: Apps/Programming + +Format: HTML +Index: /usr/share/doc/libflac-doc/html/api/index.html +Files: /usr/share/doc/libflac-doc/html/api/*.html --- flac-1.1.4.orig/debian/libflac++-dev.install +++ flac-1.1.4/debian/libflac++-dev.install @@ -0,0 +1,6 @@ +usr/lib/libFLAC++.a +usr/lib/libFLAC++.so +usr/lib/libFLAC++.la +usr/lib/pkgconfig/flac++.pc +usr/include/FLAC++ +usr/share/aclocal/libFLAC++.m4 --- flac-1.1.4.orig/debian/docs +++ flac-1.1.4/debian/docs @@ -0,0 +1 @@ +README --- flac-1.1.4.orig/debian/flac.install +++ flac-1.1.4/debian/flac.install @@ -0,0 +1,2 @@ +usr/bin +usr/share/man/man1 --- flac-1.1.4.orig/debian/libflac-doc.doc-base.ru +++ flac-1.1.4/debian/libflac-doc.doc-base.ru @@ -0,0 +1,15 @@ +Document: libflac-doc-ru +Title: FLAC Project Documentation (Russian) +Author: Josh Coalson +Abstract: This is the HTML version of the FLAC documentation, + which is more or less a mirror of the FLAC homepage. It provides instructions + for using the command-line flac and metaflac programs, descriptions of the + internal format of FLAC files, the goals of the FLAC project, Frequently Asked + Questions about FLAC, useful information for FLAC developers, and links to + other applications with FLAC support. This particular version is in Russian, + and it has only been updated to reflect changes since FLAC version 1.1.0. +Section: Apps/Sound + +Format: HTML +Index: /usr/share/doc/libflac-doc/html/ru/index.html +Files: /usr/share/doc/libflac-doc/html/ru/*.html --- flac-1.1.4.orig/debian/fixrpath +++ flac-1.1.4/debian/fixrpath @@ -0,0 +1,28 @@ +#!/bin/sh +# $Id: fixrpath,v 1.1 2004/05/27 10:48:25 kobras Exp $ +# libtool -rpath workaround based on a suggestion by Yann Dirson +# +# +# It is supposed to be inserted in configure.in, but I didn't want +# to re-run autoconf (since that bloats the Debian diff unnecessarily), +# so I just patch libtool after running configure. -- Richard Braakman +# +# +# The version of libtool included with LessTif unfortunately insists on +# linking with -rpath, i.e. hardwiring locations. This is not desirable. +# +# The dummy define is improbable enough not to conflict with anything; it is +# just here to fool libtool by making it believe it gave some useful info to +# gcc. +# +# This will also patch the generated libtool to explicitly +# link libraries against the libraries they depend on. (particularly libc) + +for i in libtool libtool-disable-static; do +sed < $i > $i-2 \ + -e 's/^hardcode_libdir_flag_spec.*$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' \ + -e '/^archive_cmds="/s/"$/ \$deplibs"/' +mv $i-2 $i +chmod 755 $i +done + --- flac-1.1.4.orig/debian/libflac-doc.install +++ flac-1.1.4/debian/libflac-doc.install @@ -0,0 +1 @@ +usr/share/doc/flac-1.1.4/html --- flac-1.1.4.orig/debian/xmms-flac.links +++ flac-1.1.4/debian/xmms-flac.links @@ -0,0 +1,2 @@ +/usr/lib/xmms/Input/libxmms-flac.so /usr/lib/bmp/Input/libxmms-flac.so +/usr/lib/xmms/Input/libxmms-flac.la /usr/lib/bmp/Input/libxmms-flac.la --- flac-1.1.4.orig/debian/xmms-flac.install +++ flac-1.1.4/debian/xmms-flac.install @@ -0,0 +1 @@ +usr/lib/xmms --- flac-1.1.4.orig/debian/rules +++ flac-1.1.4/debian/rules @@ -0,0 +1,110 @@ +#!/usr/bin/make -f +# debian/rules for flac + +include /usr/share/dpatch/dpatch.make + +top_srcdir:=$(shell pwd) +tmp:=debian/tmp +tmp_absolute:=$(top_srcdir)/$(tmp) + +CFLAGS=-g + +ifeq "$(findstring debug,$(DEB_BUILD_OPTIONS))" "" +CFLAGS += -O2 +else +CFLAGS += -O0 +endif + +DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH) + +ifeq ($(DEB_HOST_ARCH),powerpc) +EXTRA_CONFIGURE_ARGS:=--disable-asm-optimizations +else +ifeq ($(DEB_HOST_ARCH),m68k) +CFLAGS += -fno-inline-functions +else +EXTRA_CONFIGURE_ARGS= +endif +endif + +configure: patch configure-stamp +configure-stamp: patch-stamp + dh_testdir + + CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" ./configure --prefix=/usr \ + --mandir=/usr/share/man --disable-rpath $(EXTRA_CONFIGURE_ARGS) + sh debian/fixrpath + touch $@ + +build: patch configure-stamp build-stamp +build-stamp: configure-stamp + dh_testdir + + touch man/flac.1 + # Add here commands to compile the package. + $(MAKE) + + touch $@ + +clean: unpatch + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess . +endif +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub . +endif + + # Add here commands to clean up after the build process. + -$(MAKE) distclean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) DESTDIR=$(tmp_absolute) install + + dh_install --sourcedir=$(tmp) + + mv debian/libflac-doc/usr/share/doc/flac-1.1.4 \ + debian/libflac-doc/usr/share/doc/libflac-doc + +binary-indep: build install + dh_testdir -i + dh_testroot -i + dh_installdocs -i + dh_installchangelogs -i + dh_compress -i -X.html + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdebconf -a + dh_installchangelogs -a + dh_installdocs -a + dh_strip -a + dh_compress -a + dh_fixperms -a + dh_makeshlibs -a -Xxmms-flac + dh_link -a + dh_installdeb -a + dh_shlibdeps -a -ldebian/libflac8/usr/lib:debian/libflac++6/usr/lib + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- flac-1.1.4.orig/debian/compat +++ flac-1.1.4/debian/compat @@ -0,0 +1 @@ +4 --- flac-1.1.4.orig/debian/copyright +++ flac-1.1.4/debian/copyright @@ -0,0 +1,29 @@ +This package was debianized by Matt Zimmerman on +Wed, 17 Jan 2001 14:52:43 -0500. + +It was downloaded from http://flac.sourceforge.net/ + +Upstream Author: Josh Coalson + +Copyright (from src/flac/main.c): + +/* flac - Command-line FLAC encoder/decoder + * Copyright (C) 2000 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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 St, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +On Debian GNU/Linux systems, the complete text of the GNU General Public +License can be found in `/usr/share/common-licenses/GPL'. --- flac-1.1.4.orig/debian/patches/01_ldpath_fix.dpatch +++ flac-1.1.4/debian/patches/01_ldpath_fix.dpatch @@ -0,0 +1,29 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01_ldpath_fix.dpatch by Joshua Kwan +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +--- flac-1.1.4/src/libFLAC++/libFLAC++.m4~ 2007-06-06 00:48:22.000000000 -0700 ++++ flac-1.1.4/src/libFLAC++/libFLAC++.m4 2007-06-06 00:48:30.000000000 -0700 +@@ -42,7 +42,7 @@ + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" +- ac_save_LDPATH="$LD_LIBRARY_PATH" ++ ac_save_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" + CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS" + CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS" + LIBS="$LIBS $LIBFLACPP_LIBS" +--- flac-1.1.4/src/libFLAC/libFLAC.m4~ 2007-06-06 00:47:56.000000000 -0700 ++++ flac-1.1.4/src/libFLAC/libFLAC.m4 2007-06-06 00:48:04.000000000 -0700 +@@ -39,7 +39,7 @@ + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" +- ac_save_LDPATH="$LD_LIBRARY_PATH" ++ ac_save_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" + CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" + CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS" + LIBS="$LIBS $LIBFLAC_LIBS" --- flac-1.1.4.orig/debian/patches/02_doc_path.dpatch +++ flac-1.1.4/debian/patches/02_doc_path.dpatch @@ -0,0 +1,18 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 02_doc_path.dpatch by Joshua Kwan +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +--- flac-1.1.4/man/flac.1~ 2007-06-06 00:51:58.000000000 -0700 ++++ flac-1.1.4/man/flac.1 2007-06-06 00:53:51.000000000 -0700 +@@ -319,7 +319,7 @@ + .PP + metaflac(1). + .PP +-The programs are documented fully by HTML format documentation, available in \fI/usr/share/doc/flac/html\fR on Debian GNU/Linux systems. ++The programs are documented fully by HTML format documentation, available in \fI/usr/share/doc/libflac-doc/html\fR on Debian GNU/Linux systems. + .SH "AUTHOR" + .PP + This manual page was written by Matt Zimmerman for the Debian GNU/Linux system (but may be used by others). --- flac-1.1.4.orig/debian/patches/03_cosmetic_flac_stats.dpatch +++ flac-1.1.4/debian/patches/03_cosmetic_flac_stats.dpatch @@ -0,0 +1,32 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 03_cosmetic_flac_stats.dpatch by Joshua Kwan +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix misuse of \r (potentially) in flac -d or -t output, closes: #138828 + +@DPATCH@ +--- flac-1.1.2/src/flac/decode.c~ 2005-08-18 02:16:46.000000000 -0700 ++++ flac-1.1.2/src/flac/decode.c 2005-08-18 02:14:59.000000000 -0700 +@@ -1182,6 +1182,7 @@ + + void print_stats(const DecoderSession *decoder_session) + { ++ static int count = 0; + if(flac__utils_verbosity_ >= 2) { + #if defined _MSC_VER || defined __MINGW32__ + /* with MSVC you have to spoon feed it the casting */ +@@ -1190,7 +1191,13 @@ + const double progress = (double)decoder_session->samples_processed / (double)decoder_session->total_samples * 100.0; + #endif + if(decoder_session->total_samples > 0) { +- fprintf(stderr, "\r%s: %s%u%% complete", ++ while (count > 0 && count--) ++ fprintf(stderr, "\b"); ++ ++ if ((unsigned)floor(progress + 0.5) == 100) ++ return; ++ ++ count = fprintf(stderr, "%s: %s%u%% complete", + decoder_session->inbasefilename, + decoder_session->test_only? "testing, " : decoder_session->analysis_mode? "analyzing, " : "", + (unsigned)floor(progress + 0.5) --- flac-1.1.4.orig/debian/patches/00list +++ flac-1.1.4/debian/patches/00list @@ -0,0 +1,5 @@ +01_ldpath_fix +02_doc_path +03_cosmetic_flac_stats +07_metaflac_error_exit +08_SECURITY_CVE-2007-4619.dpatch --- flac-1.1.4.orig/debian/patches/07_metaflac_error_exit.dpatch +++ flac-1.1.4/debian/patches/07_metaflac_error_exit.dpatch @@ -0,0 +1,28 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 07_metaflac_error_exit.dpatch by Joshua Kwan +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Exit with error if invalid option is passed. #329979 + +--- flac-1.1.2/src/metaflac/options.c~ 2006-05-27 23:13:33.000000000 -0600 ++++ flac-1.1.2/src/metaflac/options.c 2006-05-27 23:15:07.000000000 -0600 +@@ -229,7 +229,7 @@ + } + } + +- return !had_error; ++ return had_error; + } + + void free_options(CommandLineOptions *options) +--- flac-1.1.2/src/metaflac/main.c~ 2006-05-27 23:07:51.000000000 -0600 ++++ flac-1.1.2/src/metaflac/main.c 2006-05-27 23:14:47.000000000 -0600 +@@ -32,7 +32,7 @@ + setlocale(LC_ALL, ""); + init_options(&options); + +- if(parse_options(argc, argv, &options)) ++ if ((ret = parse_options(argc, argv, &options)) == 0) + ret = !do_operations(&options); + + free_options(&options); --- flac-1.1.4.orig/debian/patches/08_SECURITY_CVE-2007-4619.dpatch +++ flac-1.1.4/debian/patches/08_SECURITY_CVE-2007-4619.dpatch @@ -0,0 +1,1447 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 08_SECURITY_CVE-2007-4619.dpatch by Jamie Strandboge +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Fix for CVE-2007-4619 + +@DPATCH@ +diff -urNad flac-1.1.4~/include/share/alloc.h flac-1.1.4/include/share/alloc.h +--- flac-1.1.4~/include/share/alloc.h 1970-01-01 00:00:00.000000000 +0000 ++++ flac-1.1.4/include/share/alloc.h 2007-10-23 20:59:48.000000000 +0000 +@@ -0,0 +1,212 @@ ++/* alloc - Convenience routines for safely allocating memory ++ * Copyright (C) 2007 Josh Coalson ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef FLAC__SHARE__ALLOC_H ++#define FLAC__SHARE__ALLOC_H ++ ++#if HAVE_CONFIG_H ++# include ++#endif ++ ++/* WATCHOUT: for c++ you may have to #define __STDC_LIMIT_MACROS 1 real early ++ * before #including this file, otherwise SIZE_MAX might not be defined ++ */ ++ ++#include /* for SIZE_MAX */ ++#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ ++#include /* for SIZE_MAX in case limits.h didn't get it */ ++#endif ++#include /* for size_t, malloc(), etc */ ++ ++#ifndef SIZE_MAX ++# ifndef SIZE_T_MAX ++# ifdef _MSC_VER ++# define SIZE_T_MAX UINT_MAX ++# else ++# error ++# endif ++# endif ++# define SIZE_MAX SIZE_T_MAX ++#endif ++ ++#ifndef FLaC__INLINE ++#define FLaC__INLINE ++#endif ++ ++/* avoid malloc()ing 0 bytes, see: ++ * https://www.securecoding.cert.org/confluence/display/seccode/MEM04-A.+Do+not+make+assumptions+about+the+result+of+allocating+0+bytes?focusedCommentId=5407003 ++*/ ++static FLaC__INLINE void *safe_malloc_(size_t size) ++{ ++ /* malloc(0) is undefined; FLAC src convention is to always allocate */ ++ if(!size) ++ size++; ++ return malloc(size); ++} ++ ++static FLaC__INLINE void *safe_calloc_(size_t nmemb, size_t size) ++{ ++ if(!nmemb || !size) ++ return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ ++ return calloc(nmemb, size); ++} ++ ++/*@@@@ there's probably a better way to prevent overflows when allocating untrusted sums but this works for now */ ++ ++static FLaC__INLINE void *safe_malloc_add_2op_(size_t size1, size_t size2) ++{ ++ size2 += size1; ++ if(size2 < size1) ++ return 0; ++ return safe_malloc_(size2); ++} ++ ++static FLaC__INLINE void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3) ++{ ++ size2 += size1; ++ if(size2 < size1) ++ return 0; ++ size3 += size2; ++ if(size3 < size2) ++ return 0; ++ return safe_malloc_(size3); ++} ++ ++static FLaC__INLINE void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4) ++{ ++ size2 += size1; ++ if(size2 < size1) ++ return 0; ++ size3 += size2; ++ if(size3 < size2) ++ return 0; ++ size4 += size3; ++ if(size4 < size3) ++ return 0; ++ return safe_malloc_(size4); ++} ++ ++static FLaC__INLINE void *safe_malloc_mul_2op_(size_t size1, size_t size2) ++#if 0 ++needs support for cases where sizeof(size_t) != 4 ++{ ++ /* could be faster #ifdef'ing off SIZEOF_SIZE_T */ ++ if(sizeof(size_t) == 4) { ++ if ((double)size1 * (double)size2 < 4294967296.0) ++ return malloc(size1*size2); ++ } ++ return 0; ++} ++#else ++/* better? */ ++{ ++ if(!size1 || !size2) ++ return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ ++ if(size1 > SIZE_MAX / size2) ++ return 0; ++ return malloc(size1*size2); ++} ++#endif ++ ++static FLaC__INLINE void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3) ++{ ++ if(!size1 || !size2 || !size3) ++ return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ ++ if(size1 > SIZE_MAX / size2) ++ return 0; ++ size1 *= size2; ++ if(size1 > SIZE_MAX / size3) ++ return 0; ++ return malloc(size1*size3); ++} ++ ++/* size1*size2 + size3 */ ++static FLaC__INLINE void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size3) ++{ ++ if(!size1 || !size2) ++ return safe_malloc_(size3); ++ if(size1 > SIZE_MAX / size2) ++ return 0; ++ return safe_malloc_add_2op_(size1*size2, size3); ++} ++ ++/* size1 * (size2 + size3) */ ++static FLaC__INLINE void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size3) ++{ ++ if(!size1 || (!size2 && !size3)) ++ return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ ++ size2 += size3; ++ if(size2 < size3) ++ return 0; ++ return safe_malloc_mul_2op_(size1, size2); ++} ++ ++static FLaC__INLINE void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2) ++{ ++ size2 += size1; ++ if(size2 < size1) ++ return 0; ++ return realloc(ptr, size2); ++} ++ ++static FLaC__INLINE void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3) ++{ ++ size2 += size1; ++ if(size2 < size1) ++ return 0; ++ size3 += size2; ++ if(size3 < size2) ++ return 0; ++ return realloc(ptr, size3); ++} ++ ++static FLaC__INLINE void *safe_realloc_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4) ++{ ++ size2 += size1; ++ if(size2 < size1) ++ return 0; ++ size3 += size2; ++ if(size3 < size2) ++ return 0; ++ size4 += size3; ++ if(size4 < size3) ++ return 0; ++ return realloc(ptr, size4); ++} ++ ++static FLaC__INLINE void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2) ++{ ++ if(!size1 || !size2) ++ return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */ ++ if(size1 > SIZE_MAX / size2) ++ return 0; ++ return realloc(ptr, size1*size2); ++} ++ ++/* size1 * (size2 + size3) */ ++static FLaC__INLINE void *safe_realloc_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3) ++{ ++ if(!size1 || (!size2 && !size3)) ++ return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */ ++ size2 += size3; ++ if(size2 < size3) ++ return 0; ++ return safe_realloc_mul_2op_(ptr, size1, size2); ++} ++ ++#endif +diff -urNad flac-1.1.4~/src/flac/main.c flac-1.1.4/src/flac/main.c +--- flac-1.1.4~/src/flac/main.c 2007-02-06 03:32:16.000000000 +0000 ++++ flac-1.1.4/src/flac/main.c 2007-10-23 20:59:48.000000000 +0000 +@@ -34,6 +34,7 @@ + #include /* for unlink() */ + #endif + #include "FLAC/all.h" ++#include "share/alloc.h" + #include "share/grabbag.h" + #include "analyze.h" + #include "decode.h" +@@ -1736,7 +1737,7 @@ + if(encode_infile != stdin && grabbag__file_are_same(infilename, outfilename)) { + static const char *tmp_suffix = ".tmp,fl-ac+en'c"; + /*@@@@ still a remote possibility that a file with this filename exists */ +- if(0 == (internal_outfilename = malloc(strlen(outfilename)+strlen(tmp_suffix)+1))) { ++ if(0 == (internal_outfilename = (char *)safe_malloc_add_3op_(strlen(outfilename), /*+*/strlen(tmp_suffix), /*+*/1))) { + flac__utils_printf(stderr, 1, "ERROR allocating memory for tempfile name\n"); + conditional_fclose(encode_infile); + return 1; +diff -urNad flac-1.1.4~/src/libFLAC/bitwriter.c flac-1.1.4/src/libFLAC/bitwriter.c +--- flac-1.1.4~/src/libFLAC/bitwriter.c 2007-02-13 02:10:33.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/bitwriter.c 2007-10-23 20:59:48.000000000 +0000 +@@ -48,6 +48,7 @@ + #include "private/bitwriter.h" + #include "private/crc.h" + #include "FLAC/assert.h" ++#include "share/alloc.h" + + /* Things should be fastest when this matches the machine word size */ + /* WATCHOUT: if you change this you must also change the following #defines down to SWAP_BE_WORD_TO_HOST below to match */ +@@ -139,7 +140,7 @@ + FLAC__ASSERT(new_capacity > bw->capacity); + FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD)); + +- new_buffer = (bwword*)realloc(bw->buffer, sizeof(bwword)*new_capacity); ++ new_buffer = (bwword*)safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity); + if(new_buffer == 0) + return false; + bw->buffer = new_buffer; +diff -urNad flac-1.1.4~/src/libFLAC/include/private/md5.h flac-1.1.4/src/libFLAC/include/private/md5.h +--- flac-1.1.4~/src/libFLAC/include/private/md5.h 2006-10-16 15:32:42.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/include/private/md5.h 2007-10-23 20:59:48.000000000 +0000 +@@ -35,7 +35,7 @@ + FLAC__uint32 bytes[2]; + FLAC__uint32 in[16]; + FLAC__byte *internal_buf; +- unsigned capacity; ++ size_t capacity; + }; + + void FLAC__MD5Init(struct FLAC__MD5Context *context); +diff -urNad flac-1.1.4~/src/libFLAC/md5.c flac-1.1.4/src/libFLAC/md5.c +--- flac-1.1.4~/src/libFLAC/md5.c 2006-11-11 22:56:47.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/md5.c 2007-10-23 20:59:48.000000000 +0000 +@@ -31,6 +31,7 @@ + #include /* for memcpy() */ + + #include "private/md5.h" ++#include "share/alloc.h" + + #ifndef FLaC__INLINE + #define FLaC__INLINE +@@ -235,7 +236,7 @@ + FLAC__byte *tmp = (FLAC__byte*)realloc(ctx->internal_buf, bytes_needed); + if(0 == tmp) { + free(ctx->internal_buf); +- if(0 == (ctx->internal_buf = (FLAC__byte*)malloc(bytes_needed))) ++ if(0 == (ctx->internal_buf = (FLAC__byte*)safe_malloc_(bytes_needed))) + return false; + } + ctx->internal_buf = tmp; +diff -urNad flac-1.1.4~/src/libFLAC/memory.c flac-1.1.4/src/libFLAC/memory.c +--- flac-1.1.4~/src/libFLAC/memory.c 2007-02-02 06:23:06.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/memory.c 2007-10-23 20:59:48.000000000 +0000 +@@ -35,6 +35,7 @@ + + #include "private/memory.h" + #include "FLAC/assert.h" ++#include "share/alloc.h" + + void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address) + { +@@ -44,7 +45,7 @@ + + #ifdef FLAC__ALIGN_MALLOC_DATA + /* align on 32-byte (256-bit) boundary */ +- x = malloc(bytes+31); ++ x = safe_malloc_add_2op_(bytes, /*+*/31); + /* there's got to be a better way to do this right for all archs */ + if(sizeof(void*) == sizeof(unsigned)) + *aligned_address = (void*)(((unsigned)x + 31) & -32); +@@ -53,7 +54,7 @@ + else + return 0; + #else +- x = malloc(bytes); ++ x = safe_malloc_(bytes); + *aligned_address = x; + #endif + return x; +@@ -72,7 +73,10 @@ + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + +- pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(FLAC__int32) * elements, &u.pv); ++ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ ++ return false; ++ ++ pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * (size_t)elements, &u.pv); + if(0 == pu) { + return false; + } +@@ -98,7 +102,10 @@ + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + +- pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint32) * elements, &u.pv); ++ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ ++ return false; ++ ++ pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + if(0 == pu) { + return false; + } +@@ -124,7 +131,10 @@ + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + +- pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint64) * elements, &u.pv); ++ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ ++ return false; ++ ++ pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + if(0 == pu) { + return false; + } +@@ -150,7 +160,10 @@ + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + +- pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(unsigned) * elements, &u.pv); ++ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ ++ return false; ++ ++ pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + if(0 == pu) { + return false; + } +@@ -178,7 +191,10 @@ + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + +- pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(FLAC__real) * elements, &u.pv); ++ if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ ++ return false; ++ ++ pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + if(0 == pu) { + return false; + } +diff -urNad flac-1.1.4~/src/libFLAC/metadata_iterators.c flac-1.1.4/src/libFLAC/metadata_iterators.c +--- flac-1.1.4~/src/libFLAC/metadata_iterators.c 2007-02-02 06:23:08.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/metadata_iterators.c 2007-10-23 20:59:48.000000000 +0000 +@@ -61,6 +61,7 @@ + + #include "FLAC/assert.h" + #include "FLAC/stream_decoder.h" ++#include "share/alloc.h" + + #ifdef max + #undef max +@@ -2101,6 +2102,9 @@ + if(read_cb(block->id, 1, id_bytes, handle) != id_bytes) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + ++ if(block_length < id_bytes) ++ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; ++ + block_length -= id_bytes; + + if(block_length == 0) { +@@ -2128,7 +2132,7 @@ + + if(block->num_points == 0) + block->points = 0; +- else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)malloc(block->num_points * sizeof(FLAC__StreamMetadata_SeekPoint)))) ++ else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(block->num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + for(i = 0; i < block->num_points; i++) { +@@ -2161,7 +2165,7 @@ + entry->entry = 0; + } + else { +- if(0 == (entry->entry = (FLAC__byte*)malloc(entry->length+1))) ++ if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_2op_(entry->length, /*+*/1))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + if(read_cb(entry->entry, 1, entry->length, handle) != entry->length) +@@ -2192,7 +2196,7 @@ + if(block->num_comments == 0) { + block->comments = 0; + } +- else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) ++ else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)safe_calloc_(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + for(i = 0; i < block->num_comments; i++) { +@@ -2247,7 +2251,7 @@ + if(track->num_indices == 0) { + track->indices = 0; + } +- else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) ++ else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + for(i = 0; i < track->num_indices; i++) { +@@ -2307,7 +2311,7 @@ + if(block->num_tracks == 0) { + block->tracks = 0; + } +- else if(0 == (block->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) ++ else if(0 == (block->tracks = (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + for(i = 0; i < block->num_tracks; i++) { +@@ -2336,7 +2340,7 @@ + if(0 != *data) + free(*data); + +- if(0 == (*data = (FLAC__byte*)malloc(*length+1))) ++ if(0 == (*data = (FLAC__byte*)safe_malloc_add_2op_(*length, /*+*/1))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + if(*length > 0) { +@@ -3155,7 +3159,7 @@ + { + static const char *tempfile_suffix = ".metadata_edit"; + if(0 == tempfile_path_prefix) { +- if(0 == (*tempfilename = (char*)malloc(strlen(filename) + strlen(tempfile_suffix) + 1))) { ++ if(0 == (*tempfilename = (char*)safe_malloc_add_3op_(strlen(filename), /*+*/strlen(tempfile_suffix), /*+*/1))) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -3169,7 +3173,7 @@ + else + p++; + +- if(0 == (*tempfilename = (char*)malloc(strlen(tempfile_path_prefix) + 1 + strlen(p) + strlen(tempfile_suffix) + 1))) { ++ if(0 == (*tempfilename = (char*)safe_malloc_add_4op_(strlen(tempfile_path_prefix), /*+*/strlen(p), /*+*/strlen(tempfile_suffix), /*+*/2))) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } +diff -urNad flac-1.1.4~/src/libFLAC/metadata_object.c flac-1.1.4/src/libFLAC/metadata_object.c +--- flac-1.1.4~/src/libFLAC/metadata_object.c 2007-02-02 06:23:09.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/metadata_object.c 2007-10-23 20:59:48.000000000 +0000 +@@ -39,6 +39,7 @@ + #include "private/metadata.h" + + #include "FLAC/assert.h" ++#include "share/alloc.h" + + + /**************************************************************************** +@@ -60,7 +61,7 @@ + FLAC__ASSERT(0 != to); + if(bytes > 0 && 0 != from) { + FLAC__byte *x; +- if(0 == (x = (FLAC__byte*)malloc(bytes))) ++ if(0 == (x = (FLAC__byte*)safe_malloc_(bytes))) + return false; + memcpy(x, from, bytes); + *to = x; +@@ -94,7 +95,7 @@ + /* realloc() failure leaves entry unchanged */ + static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length) + { +- FLAC__byte *x = (FLAC__byte*)realloc(*entry, length+1); ++ FLAC__byte *x = (FLAC__byte*)safe_realloc_add_2op_(*entry, length, /*+*/1); + if(0 != x) { + x[length] = '\0'; + *entry = x; +@@ -132,7 +133,7 @@ + else { + FLAC__byte *x; + FLAC__ASSERT(from->length > 0); +- if(0 == (x = (FLAC__byte*)malloc(from->length+1))) ++ if(0 == (x = (FLAC__byte*)safe_malloc_add_2op_(from->length, /*+*/1))) + return false; + memcpy(x, from->entry, from->length); + x[from->length] = '\0'; +@@ -150,7 +151,7 @@ + else { + FLAC__StreamMetadata_CueSheet_Index *x; + FLAC__ASSERT(from->num_indices > 0); +- if(0 == (x = (FLAC__StreamMetadata_CueSheet_Index*)malloc(from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)))) ++ if(0 == (x = (FLAC__StreamMetadata_CueSheet_Index*)safe_malloc_mul_2op_(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index)))) + return false; + memcpy(x, from->indices, from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)); + to->indices = x; +@@ -172,7 +173,7 @@ + + FLAC__ASSERT(num_points > 0); + +- object_array = (FLAC__StreamMetadata_SeekPoint*)malloc(num_points * sizeof(FLAC__StreamMetadata_SeekPoint)); ++ object_array = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)); + + if(0 != object_array) { + unsigned i; +@@ -205,7 +206,7 @@ + { + FLAC__ASSERT(num_comments > 0); + +- return (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); ++ return (FLAC__StreamMetadata_VorbisComment_Entry*)safe_calloc_(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); + } + + static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments) +@@ -344,14 +345,14 @@ + { + FLAC__ASSERT(num_indices > 0); + +- return (FLAC__StreamMetadata_CueSheet_Index*)calloc(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)); ++ return (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)); + } + + static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_new_(unsigned num_tracks) + { + FLAC__ASSERT(num_tracks > 0); + +- return (FLAC__StreamMetadata_CueSheet_Track*)calloc(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)); ++ return (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)); + } + + static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks) +@@ -537,6 +538,10 @@ + case FLAC__METADATA_TYPE_PADDING: + break; + case FLAC__METADATA_TYPE_APPLICATION: ++ if(to->length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) { /* underflow check */ ++ FLAC__metadata_object_delete(to); ++ return 0; ++ } + memcpy(&to->data.application.id, &object->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8); + if(!copy_bytes_(&to->data.application.data, object->data.application.data, object->length - FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)) { + FLAC__metadata_object_delete(to); +@@ -545,6 +550,10 @@ + break; + case FLAC__METADATA_TYPE_SEEKTABLE: + to->data.seek_table.num_points = object->data.seek_table.num_points; ++ if(to->data.seek_table.num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) { /* overflow check */ ++ FLAC__metadata_object_delete(to); ++ return 0; ++ } + if(!copy_bytes_((FLAC__byte**)&to->data.seek_table.points, (FLAC__byte*)object->data.seek_table.points, object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint))) { + FLAC__metadata_object_delete(to); + return 0; +@@ -930,8 +939,12 @@ + return false; + } + else { +- const unsigned old_size = object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint); +- const unsigned new_size = new_num_points * sizeof(FLAC__StreamMetadata_SeekPoint); ++ const size_t old_size = object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint); ++ const size_t new_size = new_num_points * sizeof(FLAC__StreamMetadata_SeekPoint); ++ ++ /* overflow check */ ++ if((size_t)new_num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) ++ return false; + + FLAC__ASSERT(object->data.seek_table.num_points > 0); + +@@ -1157,8 +1170,12 @@ + return false; + } + else { +- const unsigned old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); +- const unsigned new_size = new_num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); ++ const size_t old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); ++ const size_t new_size = new_num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); ++ ++ /* overflow check */ ++ if((size_t)new_num_comments > SIZE_MAX / sizeof(FLAC__StreamMetadata_VorbisComment_Entry)) ++ return false; + + FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0); + +@@ -1306,7 +1323,7 @@ + const size_t nn = strlen(field_name); + const size_t nv = strlen(field_value); + entry->length = nn + 1 /*=*/ + nv; +- if(0 == (entry->entry = (FLAC__byte*)malloc(entry->length+1))) ++ if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_4op_(nn, /*+*/1, /*+*/nv, /*+*/1))) + return false; + memcpy(entry->entry, field_name, nn); + entry->entry[nn] = '='; +@@ -1333,9 +1350,9 @@ + FLAC__ASSERT(0 != eq); + if(0 == eq) + return false; /* double protection */ +- if(0 == (*field_name = (char*)malloc(nn+1))) ++ if(0 == (*field_name = (char*)safe_malloc_add_2op_(nn, /*+*/1))) + return false; +- if(0 == (*field_value = (char*)malloc(nv+1))) { ++ if(0 == (*field_value = (char*)safe_malloc_add_2op_(nv, /*+*/1))) { + free(*field_name); + return false; + } +@@ -1465,8 +1482,12 @@ + return false; + } + else { +- const unsigned old_size = track->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); +- const unsigned new_size = new_num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); ++ const size_t old_size = track->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); ++ const size_t new_size = new_num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); ++ ++ /* overflow check */ ++ if((size_t)new_num_indices > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Index)) ++ return false; + + FLAC__ASSERT(track->num_indices > 0); + +@@ -1549,8 +1570,12 @@ + return false; + } + else { +- const unsigned old_size = object->data.cue_sheet.num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); +- const unsigned new_size = new_num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); ++ const size_t old_size = object->data.cue_sheet.num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); ++ const size_t new_size = new_num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); ++ ++ /* overflow check */ ++ if((size_t)new_num_tracks > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Track)) ++ return false; + + FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0); + +diff -urNad flac-1.1.4~/src/libFLAC/ogg_helper.c flac-1.1.4/src/libFLAC/ogg_helper.c +--- flac-1.1.4~/src/libFLAC/ogg_helper.c 2007-02-02 06:23:14.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/ogg_helper.c 2007-10-23 20:59:48.000000000 +0000 +@@ -36,6 +36,7 @@ + #include /* for malloc() */ + #include /* for memcmp(), memcpy() */ + #include "FLAC/assert.h" ++#include "share/alloc.h" + #include "private/ogg_helper.h" + #include "protected/stream_encoder.h" + +@@ -112,7 +113,7 @@ + } + + /* allocate space for the page header */ +- if(0 == (page->header = (unsigned char *)malloc(OGG_MAX_HEADER_LEN))) { ++ if(0 == (page->header = (unsigned char *)safe_malloc_(OGG_MAX_HEADER_LEN))) { + encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -154,7 +155,7 @@ + } + + /* allocate space for the page body */ +- if(0 == (page->body = (unsigned char *)malloc(page->body_len))) { ++ if(0 == (page->body = (unsigned char *)safe_malloc_(page->body_len))) { + encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } +diff -urNad flac-1.1.4~/src/libFLAC/stream_decoder.c flac-1.1.4/src/libFLAC/stream_decoder.c +--- flac-1.1.4~/src/libFLAC/stream_decoder.c 2007-02-06 03:32:39.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/stream_decoder.c 2007-10-23 20:59:48.000000000 +0000 +@@ -53,6 +53,7 @@ + #endif + #endif + #include "FLAC/assert.h" ++#include "share/alloc.h" + #include "protected/stream_decoder.h" + #include "private/bitreader.h" + #include "private/bitmath.h" +@@ -181,7 +182,7 @@ + FLAC__StreamMetadata seek_table; + FLAC__bool metadata_filter[128]; /* MAGIC number 128 == total number of metadata block types == 1 << 7 */ + FLAC__byte *metadata_filter_ids; +- unsigned metadata_filter_ids_count, metadata_filter_ids_capacity; /* units for both are IDs, not bytes */ ++ size_t metadata_filter_ids_count, metadata_filter_ids_capacity; /* units for both are IDs, not bytes */ + FLAC__Frame frame; + FLAC__bool cached; /* true if there is a byte in lookahead */ + FLAC__CPUInfo cpuinfo; +@@ -307,7 +308,7 @@ + } + + decoder->private_->metadata_filter_ids_capacity = 16; +- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) { ++ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_malloc_mul_2op_((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), decoder->private_->metadata_filter_ids_capacity))) { + FLAC__bitreader_delete(decoder->private_->input); + free(decoder->private_); + free(decoder->protected_); +@@ -780,7 +781,7 @@ + FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids); + + if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) { +- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2))) { ++ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -839,7 +840,7 @@ + FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids); + + if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) { +- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2))) { ++ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1316,7 +1317,7 @@ + * (at negative indices) for alignment purposes; we use 4 + * to keep the data well-aligned. + */ +- tmp = (FLAC__int32*)malloc(sizeof(FLAC__int32)*(size+4)); ++ tmp = (FLAC__int32*)safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/); + if(tmp == 0) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; +@@ -1341,7 +1342,7 @@ + + FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id) + { +- unsigned i; ++ size_t i; + + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); +@@ -1462,6 +1463,11 @@ + if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)) + return false; /* read_callback_ sets the state for us */ + ++ if(real_length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) { /* underflow check */ ++ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;/*@@@@@@ maybe wrong error? need to resync?*/ ++ return false; ++ } ++ + real_length -= FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8; + + if(decoder->private_->metadata_filter_ids_count > 0 && has_id_filtered_(decoder, block.data.application.id)) +@@ -1524,7 +1530,7 @@ + if(!decoder->private_->is_seeking && decoder->private_->metadata_callback) + decoder->private_->metadata_callback(decoder, &block, decoder->private_->client_data); + +- /* now we have to free any malloc'ed data in the block */ ++ /* now we have to free any malloc()ed data in the block */ + switch(type) { + case FLAC__METADATA_TYPE_PADDING: + break; +@@ -1664,7 +1670,7 @@ + decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; + + /* use realloc since we may pass through here several times (e.g. after seeking) */ +- if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)realloc(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint)))) { ++ if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1703,7 +1709,7 @@ + if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length)) + return false; /* read_callback_ sets the state for us */ + if(obj->vendor_string.length > 0) { +- if(0 == (obj->vendor_string.entry = (FLAC__byte*)malloc(obj->vendor_string.length+1))) { ++ if(0 == (obj->vendor_string.entry = (FLAC__byte*)safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1721,7 +1727,7 @@ + + /* read comments */ + if(obj->num_comments > 0) { +- if(0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)malloc(obj->num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) { ++ if(0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)safe_malloc_mul_2op_(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1730,7 +1736,7 @@ + if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length)) + return false; /* read_callback_ sets the state for us */ + if(obj->comments[i].length > 0) { +- if(0 == (obj->comments[i].entry = (FLAC__byte*)malloc(obj->comments[i].length+1))) { ++ if(0 == (obj->comments[i].entry = (FLAC__byte*)safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1776,7 +1782,7 @@ + obj->num_tracks = x; + + if(obj->num_tracks > 0) { +- if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) { ++ if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1809,7 +1815,7 @@ + track->num_indices = (FLAC__byte)x; + + if(track->num_indices > 0) { +- if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) { ++ if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1845,7 +1851,7 @@ + /* read MIME type */ + if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) + return false; /* read_callback_ sets the state for us */ +- if(0 == (obj->mime_type = (char*)malloc(len+1))) { ++ if(0 == (obj->mime_type = (char*)safe_malloc_add_2op_(len, /*+*/1))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1858,7 +1864,7 @@ + /* read description */ + if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) + return false; /* read_callback_ sets the state for us */ +- if(0 == (obj->description = (FLAC__byte*)malloc(len+1))) { ++ if(0 == (obj->description = (FLAC__byte*)safe_malloc_add_2op_(len, /*+*/1))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +@@ -1887,7 +1893,7 @@ + /* read data */ + if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &(obj->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) + return false; /* read_callback_ sets the state for us */ +- if(0 == (obj->data = (FLAC__byte*)malloc(obj->data_length))) { ++ if(0 == (obj->data = (FLAC__byte*)safe_malloc_(obj->data_length))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } +diff -urNad flac-1.1.4~/src/libFLAC/stream_encoder.c flac-1.1.4/src/libFLAC/stream_encoder.c +--- flac-1.1.4~/src/libFLAC/stream_encoder.c 2007-02-06 23:12:29.000000000 +0000 ++++ flac-1.1.4/src/libFLAC/stream_encoder.c 2007-10-23 20:59:48.000000000 +0000 +@@ -54,6 +54,7 @@ + #endif + #include "FLAC/assert.h" + #include "FLAC/stream_decoder.h" ++#include "share/alloc.h" + #include "protected/stream_encoder.h" + #include "private/bitwriter.h" + #include "private/bitmath.h" +@@ -998,7 +999,7 @@ + */ + encoder->private_->verify.input_fifo.size = encoder->protected_->blocksize+OVERREAD_; + for(i = 0; i < encoder->protected_->channels; i++) { +- if(0 == (encoder->private_->verify.input_fifo.data[i] = (FLAC__int32*)malloc(sizeof(FLAC__int32) * encoder->private_->verify.input_fifo.size))) { ++ if(0 == (encoder->private_->verify.input_fifo.data[i] = (FLAC__int32*)safe_malloc_mul_2op_(sizeof(FLAC__int32), encoder->private_->verify.input_fifo.size))) { + encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; + } +@@ -1721,7 +1722,7 @@ + } + if(num_blocks) { + FLAC__StreamMetadata **m; +- if(0 == (m = (FLAC__StreamMetadata**)malloc(sizeof(m[0]) * num_blocks))) ++ if(0 == (m = (FLAC__StreamMetadata**)safe_malloc_mul_2op_(sizeof(m[0]), /*times*/num_blocks))) + return false; + memcpy(m, metadata, sizeof(m[0]) * num_blocks); + encoder->protected_->metadata = m; +diff -urNad flac-1.1.4~/src/libFLAC++/metadata.cpp flac-1.1.4/src/libFLAC++/metadata.cpp +--- flac-1.1.4~/src/libFLAC++/metadata.cpp 2007-02-05 01:58:18.000000000 +0000 ++++ flac-1.1.4/src/libFLAC++/metadata.cpp 2007-10-23 20:59:48.000000000 +0000 +@@ -29,6 +29,8 @@ + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + ++#define __STDC_LIMIT_MACROS 1 /* otherwise SIZE_MAX is not defined for c++ */ ++#include "share/alloc.h" + #include "FLAC++/metadata.h" + #include "FLAC/assert.h" + #include // for malloc(), free() +@@ -574,7 +576,7 @@ + + clear_entry(); + +- if(0 == (entry_.entry = (FLAC__byte*)malloc(field_length+1))) { ++ if(0 == (entry_.entry = (FLAC__byte*)safe_malloc_add_2op_(field_length, /*+*/1))) { + is_valid_ = false; + } + else { +@@ -623,7 +625,7 @@ + + clear_field_value(); + +- if(0 == (field_value_ = (char *)malloc(field_value_length+1))) { ++ if(0 == (field_value_ = (char *)safe_malloc_add_2op_(field_value_length, /*+*/1))) { + is_valid_ = false; + } + else { +@@ -713,7 +715,7 @@ + { + clear_entry(); + +- if(0 == (entry_.entry = (FLAC__byte*)malloc(field_name_length_ + 1 + field_value_length_ + 1))) { ++ if(0 == (entry_.entry = (FLAC__byte*)safe_malloc_add_4op_(field_name_length_, /*+*/1, /*+*/field_value_length_, /*+*/1))) { + is_valid_ = false; + } + else { +@@ -739,7 +741,7 @@ + p = (const char *)entry_.entry + entry_.length; + + field_name_length_ = p - (const char *)entry_.entry; +- if(0 == (field_name_ = (char *)malloc(field_name_length_ + 1))) { // +1 for the trailing \0 ++ if(0 == (field_name_ = (char *)safe_malloc_add_2op_(field_name_length_, /*+*/1))) { // +1 for the trailing \0 + is_valid_ = false; + return; + } +@@ -748,14 +750,14 @@ + + if(entry_.length - field_name_length_ == 0) { + field_value_length_ = 0; +- if(0 == (field_value_ = (char *)malloc(0))) { ++ if(0 == (field_value_ = (char *)safe_malloc_(0))) { + is_valid_ = false; + return; + } + } + else { + field_value_length_ = entry_.length - field_name_length_ - 1; +- if(0 == (field_value_ = (char *)malloc(field_value_length_ + 1))) { // +1 for the trailing \0 ++ if(0 == (field_value_ = (char *)safe_malloc_add_2op_(field_value_length_, /*+*/1))) { // +1 for the trailing \0 + is_valid_ = false; + return; + } +diff -urNad flac-1.1.4~/src/metaflac/operations.c flac-1.1.4/src/metaflac/operations.c +--- flac-1.1.4~/src/metaflac/operations.c 2007-02-02 06:23:52.000000000 +0000 ++++ flac-1.1.4/src/metaflac/operations.c 2007-10-23 20:59:48.000000000 +0000 +@@ -25,6 +25,7 @@ + #include "utils.h" + #include "FLAC/assert.h" + #include "FLAC/metadata.h" ++#include "share/alloc.h" + #include "share/grabbag.h" + #include + #include +@@ -445,8 +446,8 @@ + } + + if( +- 0 == (title_gains = (float*)malloc(sizeof(float) * num_files)) || +- 0 == (title_peaks = (float*)malloc(sizeof(float) * num_files)) ++ 0 == (title_gains = (float*)safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) || ++ 0 == (title_peaks = (float*)safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) + ) + die("out of memory allocating space for title gains/peaks"); + +diff -urNad flac-1.1.4~/src/metaflac/options.c flac-1.1.4/src/metaflac/options.c +--- flac-1.1.4~/src/metaflac/options.c 2007-10-23 20:59:33.000000000 +0000 ++++ flac-1.1.4/src/metaflac/options.c 2007-10-23 20:59:48.000000000 +0000 +@@ -24,6 +24,7 @@ + #include "usage.h" + #include "utils.h" + #include "FLAC/assert.h" ++#include "share/alloc.h" + #include "share/grabbag/replaygain.h" + #include + #include +@@ -185,7 +186,7 @@ + + if(options->num_files > 0) { + unsigned i = 0; +- if(0 == (options->filenames = (char**)malloc(sizeof(char*) * options->num_files))) ++ if(0 == (options->filenames = (char**)safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files))) + die("out of memory allocating space for file names list"); + while(share__optind < argc) + options->filenames[i++] = local_strdup(argv[share__optind++]); +@@ -718,8 +719,10 @@ + } + if(options->ops.capacity <= options->ops.num_operations) { + unsigned original_capacity = options->ops.capacity; +- options->ops.capacity *= 4; +- if(0 == (options->ops.operations = (Operation*)realloc(options->ops.operations, sizeof(Operation) * options->ops.capacity))) ++ if(options->ops.capacity > SIZE_MAX / 2) /* overflow check */ ++ die("out of memory allocating space for option list"); ++ options->ops.capacity *= 2; ++ if(0 == (options->ops.operations = (Operation*)safe_realloc_mul_2op_(options->ops.operations, sizeof(Operation), /*times*/options->ops.capacity))) + die("out of memory allocating space for option list"); + memset(options->ops.operations + original_capacity, 0, sizeof(Operation) * (options->ops.capacity - original_capacity)); + } +@@ -737,8 +740,10 @@ + } + if(options->args.capacity <= options->args.num_arguments) { + unsigned original_capacity = options->args.capacity; +- options->args.capacity *= 4; +- if(0 == (options->args.arguments = (Argument*)realloc(options->args.arguments, sizeof(Argument) * options->args.capacity))) ++ if(options->args.capacity > SIZE_MAX / 2) /* overflow check */ ++ die("out of memory allocating space for option list"); ++ options->args.capacity *= 2; ++ if(0 == (options->args.arguments = (Argument*)safe_realloc_mul_2op_(options->args.arguments, sizeof(Argument), /*times*/options->args.capacity))) + die("out of memory allocating space for option list"); + memset(options->args.arguments + original_capacity, 0, sizeof(Argument) * (options->args.capacity - original_capacity)); + } +@@ -969,7 +974,7 @@ + + /* make space */ + FLAC__ASSERT(out->num_entries > 0); +- if(0 == (out->entries = (unsigned*)malloc(sizeof(unsigned) * out->num_entries))) ++ if(0 == (out->entries = (unsigned*)safe_malloc_mul_2op_(sizeof(unsigned), /*times*/out->num_entries))) + die("out of memory allocating space for option list"); + + /* load 'em up */ +@@ -1008,7 +1013,7 @@ + + /* make space */ + FLAC__ASSERT(out->num_entries > 0); +- if(0 == (out->entries = (Argument_BlockTypeEntry*)malloc(sizeof(Argument_BlockTypeEntry) * out->num_entries))) ++ if(0 == (out->entries = (Argument_BlockTypeEntry*)safe_malloc_mul_2op_(sizeof(Argument_BlockTypeEntry), /*times*/out->num_entries))) + die("out of memory allocating space for option list"); + + /* load 'em up */ +diff -urNad flac-1.1.4~/src/metaflac/utils.c flac-1.1.4/src/metaflac/utils.c +--- flac-1.1.4~/src/metaflac/utils.c 2007-02-02 06:24:17.000000000 +0000 ++++ flac-1.1.4/src/metaflac/utils.c 2007-10-23 20:59:48.000000000 +0000 +@@ -22,6 +22,7 @@ + + #include "utils.h" + #include "FLAC/assert.h" ++#include "share/alloc.h" + #include "share/utf8.h" + #include + #include +@@ -57,7 +58,7 @@ + + void local_strcat(char **dest, const char *source) + { +- unsigned ndest, nsource; ++ size_t ndest, nsource; + + FLAC__ASSERT(0 != dest); + FLAC__ASSERT(0 != source); +@@ -68,7 +69,7 @@ + if(nsource == 0) + return; + +- *dest = (char*)realloc(*dest, ndest + nsource + 1); ++ *dest = (char*)safe_realloc_add_3op_(*dest, ndest, /*+*/nsource, /*+*/1); + if(0 == *dest) + die("out of memory growing string"); + strcpy((*dest)+ndest, source); +diff -urNad flac-1.1.4~/src/plugin_common/charset.c flac-1.1.4/src/plugin_common/charset.c +--- flac-1.1.4~/src/plugin_common/charset.c 2007-02-02 06:24:34.000000000 +0000 ++++ flac-1.1.4/src/plugin_common/charset.c 2007-10-23 20:59:48.000000000 +0000 +@@ -83,6 +83,8 @@ + /* Due to a GLIBC bug, round outbuf_size up to a multiple of 4 */ + /* + 1 for nul in case len == 1 */ + outsize = ((length + 3) & ~3) + 1; ++ if(outsize < length) /* overflow check */ ++ return NULL; + out = (char*)malloc(outsize); + outleft = outsize - 1; + outptr = out; +@@ -95,6 +97,10 @@ + { + case E2BIG: + used = outptr - out; ++ if((outsize - 1) * 2 + 1 <= outsize) { /* overflow check */ ++ free(out); ++ return NULL; ++ } + outsize = (outsize - 1) * 2 + 1; + out = realloc(out, outsize); + outptr = out + used; +diff -urNad flac-1.1.4~/src/plugin_common/tags.c flac-1.1.4/src/plugin_common/tags.c +--- flac-1.1.4~/src/plugin_common/tags.c 2007-02-02 06:24:45.000000000 +0000 ++++ flac-1.1.4/src/plugin_common/tags.c 2007-10-23 20:59:48.000000000 +0000 +@@ -29,9 +29,9 @@ + #include "FLAC/metadata.h" + + +-static __inline unsigned local__wide_strlen(const FLAC__uint16 *s) ++static __inline size_t local__wide_strlen(const FLAC__uint16 *s) + { +- unsigned n = 0; ++ size_t n = 0; + while(*s++) + n++; + return n; +@@ -43,7 +43,7 @@ + * and a more clear explanation at the end of this section: + * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + */ +-static __inline unsigned local__utf8len(const FLAC__byte *utf8) ++static __inline size_t local__utf8len(const FLAC__byte *utf8) + { + FLAC__ASSERT(0 != utf8); + if ((utf8[0] & 0x80) == 0) { +@@ -85,9 +85,9 @@ + } + + +-static __inline unsigned local__utf8_to_ucs2(const FLAC__byte *utf8, FLAC__uint16 *ucs2) ++static __inline size_t local__utf8_to_ucs2(const FLAC__byte *utf8, FLAC__uint16 *ucs2) + { +- const unsigned len = local__utf8len(utf8); ++ const size_t len = local__utf8len(utf8); + + FLAC__ASSERT(0 != ucs2); + +@@ -106,7 +106,7 @@ + static FLAC__uint16 *local__convert_utf8_to_ucs2(const char *src, unsigned length) + { + FLAC__uint16 *out; +- unsigned chars = 0; ++ size_t chars = 0; + + FLAC__ASSERT(0 != src); + +@@ -114,7 +114,7 @@ + { + const unsigned char *s, *end; + for (s=(const unsigned char *)src, end=s+length; sentry, entry->length + value_len + separator_len + 1))) ++ if(0 == (new_entry = (FLAC__byte*)safe_realloc_add_4op_(entry->entry, entry->length, /*+*/value_len, /*+*/separator_len, /*+*/1))) + return false; + memcpy(new_entry+entry->length, separator, separator_len); + entry->length += separator_len; +diff -urNad flac-1.1.4~/src/plugin_xmms/plugin.c flac-1.1.4/src/plugin_xmms/plugin.c +--- flac-1.1.4~/src/plugin_xmms/plugin.c 2007-02-02 06:25:10.000000000 +0000 ++++ flac-1.1.4/src/plugin_xmms/plugin.c 2007-10-23 20:59:48.000000000 +0000 +@@ -400,8 +400,13 @@ + if(title) { + if (!is_http_source(filename)) { + static const char *errtitle = "Invalid FLAC File: "; +- *title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1); +- sprintf(*title, "%s\"%s\"", errtitle, filename); ++ if(strlen(errtitle) + 1 + strlen(filename) + 1 + 1 < strlen(filename)) { /* overflow check */ ++ *title = NULL; ++ } ++ else { ++ *title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1); ++ sprintf(*title, "%s\"%s\"", errtitle, filename); ++ } + } else { + *title = NULL; + } +diff -urNad flac-1.1.4~/src/share/grabbag/picture.c flac-1.1.4/src/share/grabbag/picture.c +--- flac-1.1.4~/src/share/grabbag/picture.c 2007-02-06 00:27:44.000000000 +0000 ++++ flac-1.1.4/src/share/grabbag/picture.c 2007-10-23 20:59:48.000000000 +0000 +@@ -20,6 +20,7 @@ + # include + #endif + ++#include "share/alloc.h" + #include "share/grabbag.h" + #include "FLAC/assert.h" + #include +@@ -29,7 +30,7 @@ + /* slightly different that strndup(): this always copies 'size' bytes starting from s into a NUL-terminated string. */ + static char *local__strndup_(const char *s, size_t size) + { +- char *x = (char*)malloc(size+1); ++ char *x = (char*)safe_malloc_add_2op_(size, /*+*/1); + if(x) { + memcpy(x, s, size); + x[size] = '\0'; +@@ -357,7 +358,7 @@ + if(size < 0) + *error_message = error_messages[5]; + else { +- FLAC__byte *buffer = (FLAC__byte*)malloc(size); ++ FLAC__byte *buffer = (FLAC__byte*)safe_malloc_(size); + if(0 == buffer) + *error_message = error_messages[0]; + else { +diff -urNad flac-1.1.4~/src/share/utf8/charset.c flac-1.1.4/src/share/utf8/charset.c +--- flac-1.1.4~/src/share/utf8/charset.c 2006-05-24 04:41:37.000000000 +0000 ++++ flac-1.1.4/src/share/utf8/charset.c 2007-10-23 20:59:48.000000000 +0000 +@@ -35,6 +35,7 @@ + + #include + ++#include "share/alloc.h" + #include "charset.h" + + #include "charmaps.h" +@@ -492,7 +493,7 @@ + if (!charset1 || !charset2 ) + return -1; + +- tobuf = (char *)malloc(fromlen * charset2->max + 1); ++ tobuf = (char *)safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1); + if (!tobuf) + return -2; + +diff -urNad flac-1.1.4~/src/share/utf8/iconvert.c flac-1.1.4/src/share/utf8/iconvert.c +--- flac-1.1.4~/src/share/utf8/iconvert.c 2006-05-24 04:41:37.000000000 +0000 ++++ flac-1.1.4/src/share/utf8/iconvert.c 2007-10-23 20:59:48.000000000 +0000 +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include "share/alloc.h" + + /* + * Convert data from one encoding to another. Return: +@@ -79,7 +80,7 @@ + * This is deliberately not a config option as people often + * change their iconv library without rebuilding applications. + */ +- tocode1 = (char *)malloc(strlen(tocode) + 11); ++ tocode1 = (char *)safe_malloc_add_2op_(strlen(tocode), /*+*/11); + if (!tocode1) + goto fail; + +@@ -117,6 +118,8 @@ + break; + if (obl < 6) { + /* Enlarge the buffer */ ++ if(utflen*2 < utflen) /* overflow check */ ++ goto fail; + utflen *= 2; + newbuf = (char *)realloc(utfbuf, utflen); + if (!newbuf) +@@ -143,7 +146,7 @@ + iconv_close(cd1); + return ret; + } +- newbuf = (char *)realloc(utfbuf, (ob - utfbuf) + 1); ++ newbuf = (char *)safe_realloc_add_2op_(utfbuf, (ob - utfbuf), /*+*/1); + if (!newbuf) + goto fail; + ob = (ob - utfbuf) + newbuf; +@@ -194,7 +197,7 @@ + outlen += ob - tbuf; + + /* Convert from UTF-8 for real */ +- outbuf = (char *)malloc(outlen + 1); ++ outbuf = (char *)safe_malloc_add_2op_(outlen, /*+*/1); + if (!outbuf) + goto fail; + ib = utfbuf; +diff -urNad flac-1.1.4~/src/share/utf8/utf8.c flac-1.1.4/src/share/utf8/utf8.c +--- flac-1.1.4~/src/share/utf8/utf8.c 2007-02-11 00:38:47.000000000 +0000 ++++ flac-1.1.4/src/share/utf8/utf8.c 2007-10-23 20:59:48.000000000 +0000 +@@ -2,6 +2,8 @@ + * Copyright (C) 2001 Peter Harris + * Copyright (C) 2001 Edmund Grimley Evans + * ++ * Buffer overflow checking added: Josh Coalson, 9/9/2007 ++ * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or +@@ -28,6 +30,7 @@ + #include + #include + ++#include "share/alloc.h" + #include "utf8.h" + #include "charset.h" + +@@ -43,7 +46,8 @@ + + static unsigned char *make_utf8_string(const wchar_t *unicode) + { +- int size = 0, index = 0, out_index = 0; ++ size_t size = 0, n; ++ int index = 0, out_index = 0; + unsigned char *out; + unsigned short c; + +@@ -51,16 +55,19 @@ + c = unicode[index++]; + while(c) { + if(c < 0x0080) { +- size += 1; ++ n = 1; + } else if(c < 0x0800) { +- size += 2; ++ n = 2; + } else { +- size += 3; ++ n = 3; + } ++ if(size+n < size) /* overflow check */ ++ return NULL; ++ size += n; + c = unicode[index++]; +- } ++ } + +- out = malloc(size + 1); ++ out = safe_malloc_add_2op_(size, /*+*/1); + if (out == NULL) + return NULL; + index = 0; +@@ -87,7 +94,8 @@ + + static wchar_t *make_unicode_string(const unsigned char *utf8) + { +- int size = 0, index = 0, out_index = 0; ++ size_t size = 0; ++ int index = 0, out_index = 0; + wchar_t *out; + unsigned char c; + +@@ -101,11 +109,15 @@ + } else { + index += 1; + } +- size += 1; ++ if(size + 1 == 0) /* overflow check */ ++ return NULL; ++ size++; + c = utf8[index++]; +- } ++ } + +- out = malloc((size + 1) * sizeof(wchar_t)); ++ if(size + 1 == 0) /* overflow check */ ++ return NULL; ++ out = safe_malloc_mul_2op_(size+1, /*times*/sizeof(wchar_t)); + if (out == NULL) + return NULL; + index = 0; +@@ -147,7 +159,10 @@ + return -1; + } + +- unicode = calloc(wchars + 1, sizeof(unsigned short)); ++ if(wchars < 0) /* underflow check */ ++ return -1; ++ ++ unicode = safe_calloc_((size_t)wchars + 1, sizeof(unsigned short)); + if(unicode == NULL) + { + fprintf(stderr, "Out of memory processing string to UTF8\n"); +@@ -190,6 +205,9 @@ + chars = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, + -1, NULL, 0, NULL, NULL); + ++ if(chars < 0) /* underflow check */ ++ return -1; ++ + if(chars == 0) + { + fprintf(stderr, "Unicode translation error %d\n", GetLastError()); +@@ -197,7 +215,7 @@ + return -1; + } + +- *to = calloc(chars + 1, sizeof(unsigned char)); ++ *to = safe_calloc_((size_t)chars + 1, sizeof(unsigned char)); + if(*to == NULL) + { + fprintf(stderr, "Out of memory processing string to local charset\n"); +@@ -279,7 +297,7 @@ + if (ret != -1) + return ret; + +- s = malloc(fromlen + 1); ++ s = safe_malloc_add_2op_(fromlen, /*+*/1); + if (!s) + return -1; + strcpy(s, from); --- flac-1.1.4.orig/debian/xmms-flac.dirs +++ flac-1.1.4/debian/xmms-flac.dirs @@ -0,0 +1 @@ +usr/lib/bmp/Input --- flac-1.1.4.orig/debian/control +++ flac-1.1.4/debian/control @@ -0,0 +1,119 @@ +Source: flac +Section: sound +Priority: optional +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Joshua Kwan +Build-Depends: debhelper (>= 4), nasm (>= 0.98.34-1) [i386], doxygen, libid3-3.8.3-dev (>= 3.8.3-4.2), libogg-dev, g++ (>= 2:3.2), dpatch +Standards-Version: 3.7.2 + +Package: flac +Section: sound +Architecture: any +Depends: ${shlibs:Depends} +Description: Free Lossless Audio Codec - command line tools + FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is + similar to MP3, but lossless. The FLAC project consists of: + . + * The stream format + * libFLAC, which implements a reference encoder, stream decoder, and file + decoder + * flac, which is a command-line wrapper around libFLAC to encode and decode + .flac files + * Input plugins for various music players (Winamp, XMMS, and more in the + works) + . + This package contains the command-line tools flac (used for encoding and + decoding FLACs) and metaflac (used for manipulating FLAC metadata.) + +Package: libflac8 +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Conflicts: libflac4 (= 1.1.1-1) +Replaces: libflac4 (= 1.1.1-1) +Description: Free Lossless Audio Codec - runtime C library + FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is + similar to MP3, but lossless. The FLAC project consists of: + . + * The stream format + * libFLAC, which implements a reference encoder, stream decoder, and file + decoder + * flac, which is a command-line wrapper around libFLAC to encode and decode + .flac files + * Input plugins for various music players (Winamp, XMMS, and more in the + works) + . + This package contains the runtime library libFLAC. + +Package: libflac-doc +Section: doc +Architecture: all +Suggests: libflac-dev +Recommends: doc-base +Description: Free Lossless Audio Codec - library documentation + FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is + similar to MP3, but lossless. The FLAC project consists of: + . + * The stream format + * libFLAC, which implements a reference encoder, stream decoder, and file + decoder + * flac, which is a command-line wrapper around libFLAC to encode and decode + .flac files + * Input plugins for various music players (Winamp, XMMS, and more in the + works) + . + This package contains the API documentation for all the FLAC libraries. + +Package: libflac-dev +Section: libdevel +Architecture: any +Depends: libflac8 (= ${binary:Version}), libogg-dev, libc6-dev +Description: Free Lossless Audio Codec - C development library + FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is + similar to MP3, but lossless. The FLAC project consists of: + . + * The stream format + * libFLAC, which implements a reference encoder, stream decoder, and file + decoder + * flac, which is a command-line wrapper around libFLAC to encode and decode + .flac files + * Input plugins for various music players (Winamp, XMMS, and more in the + works) + . + This package contains the development library libFLAC. + +Package: libflac++6 +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Description: Free Lossless Audio Codec - C++ runtime library + FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is + similar to MP3, but lossless. The FLAC project consists of: + . + * The stream format + * libFLAC, which implements a reference encoder, stream decoder, and file + decoder + * flac, which is a command-line wrapper around libFLAC to encode and decode + .flac files + * Input plugins for various music players (Winamp, XMMS, and more in the + works) + . + This package contains the runtime library libFLAC++. + +Package: libflac++-dev +Section: libdevel +Architecture: any +Depends: libflac-dev, libflac++6 (= ${binary:Version}) +Description: Free Lossless Audio Codec - C++ development library + FLAC stands for Free Lossless Audio Codec. Grossly oversimplified, FLAC is + similar to MP3, but lossless. The FLAC project consists of: + . + * The stream format + * libFLAC, which implements a reference encoder, stream decoder, and file + decoder + * flac, which is a command-line wrapper around libFLAC to encode and decode + .flac files + * Input plugins for various music players (Winamp, XMMS, and more in the + works) + . + This package contains the development library libFLAC++. --- flac-1.1.4.orig/debian/libflac-doc.doc-base.web +++ flac-1.1.4/debian/libflac-doc.doc-base.web @@ -0,0 +1,14 @@ +Document: libflac-doc-web +Title: FLAC Project Documentation +Author: Josh Coalson +Abstract: This is the HTML version of the FLAC documentation, + which is more or less a mirror of the FLAC homepage. It provides instructions + for using the command-line flac and metaflac programs, descriptions of the + internal format of FLAC files, the goals of the FLAC project, Frequently Asked + Questions about FLAC, useful information for FLAC developers, and links to + other applications with FLAC support. +Section: Apps/Sound + +Format: HTML +Index: /usr/share/doc/libflac-doc/html/index.html +Files: /usr/share/doc/libflac-doc/html/*.html --- flac-1.1.4.orig/debian/libflac8.install +++ flac-1.1.4/debian/libflac8.install @@ -0,0 +1 @@ +usr/lib/libFLAC.so.* --- flac-1.1.4.orig/debian/watch +++ flac-1.1.4/debian/watch @@ -0,0 +1,3 @@ +version=3 + +http://sf.net/flac/flac-([0-9\.]*)\.tar\.gz