debian/0000775000000000000000000000000013113544516007173 5ustar debian/libsndfile1.install0000664000000000000000000000002412170473033012750 0ustar usr/lib/*/lib*.so.* debian/sndfile-programs.install0000664000000000000000000000036412170473033014037 0ustar usr/bin/sndfile-cmp usr/bin/sndfile-concat usr/bin/sndfile-convert usr/bin/sndfile-deinterleave usr/bin/sndfile-info usr/bin/sndfile-interleave usr/bin/sndfile-metadata-get usr/bin/sndfile-metadata-set usr/bin/sndfile-play usr/share/man/man1/* debian/control0000664000000000000000000000563612253266660010615 0ustar Source: libsndfile Section: devel Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Erik de Castro Lopo Build-Depends: debhelper (>= 8.1.3), dh-autoreconf, pkg-config, libvorbis-dev (>= 1.2.3), libflac-dev (>= 1.1.4-3), libasound2-dev [linux-any] Standards-Version: 3.9.3 Homepage: http://www.mega-nerd.com/libsndfile/ Package: libsndfile1-dev Section: libdevel Architecture: any Depends: ${misc:Depends}, libsndfile1 (= ${binary:Version}), pkg-config, libvorbis-dev (>= 1.2.3), libflac-dev (>= 1.1.4-3) Conflicts: libsndfile-dev, libsndfile0-dev Replaces: libsndfile-dev Provides: libsndfile-dev Description: Development files for libsndfile; a library for reading/writing audio files libsndfile is a library of C routines for reading and writing files containing sampled audio data. . This is the development version of libsndfile. You will need this only if you intend to compile programs that use this library. Package: libsndfile1 Section: libs Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: ${misc:Depends}, ${shlibs:Depends} Description: Library for reading/writing audio files libsndfile is a library of C routines for reading and writing files containing sampled audio data. . Various versions of WAV (integer, floating point, GSM, and compressed formats); Microsoft PCM, A-law and u-law formats; AIFF, AIFC and RIFX; various AU/SND formats (Sun/NeXT, Dec AU, G721 and G723 ADPCM); RAW header-less PCM files; Amiga IFF/8SVX/16SV PCM files; Ensoniq PARIS (.PAF); Apple's Core Audio Format (CAF) and others. Package: sndfile-programs Section: utils Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Recommends: sndfile-tools Description: Sample programs that use libsndfile This package contains simple programs which use libsndfile for operating on sound files. . Programs include: - sndfile-cmp : compare the audio data of two files - sndfile-concat : concatenate two or more files - sndfile-convert : convert between sound file formats - sndfile-info : print information about files - sndfile-metadata-get/set : get and set file metadata - sndfile-play : play a sound file Package: libsndfile1-dbg Architecture: any Section: debug Priority: extra Depends: libsndfile1 (= ${binary:Version}), ${misc:Depends} Description: debugging symbols for libsndfile libsndfile is a library of C routines for reading and writing files containing sampled audio data. . This package contains the debugging symbols for libsndfile. Package: sndfile-programs-dbg Architecture: any Section: debug Priority: extra Depends: sndfile-programs (= ${binary:Version}), ${misc:Depends} Description: debugging symbols for sndfile-programs This package contains simple programs which use libsndfile for operating on sound files. . This package contains the debugging symbols for sndfile-programs. debian/README.source0000664000000000000000000000034412170473033011350 0ustar The Debian version of libsndfile has a couple of small patches applied which have not yet been pushed upstream. On a Debian system you can read about how to apply the debian patches here: /usr/share/doc/quilt/README.source debian/libsndfile1.symbols0000664000000000000000000000262412170473033013002 0ustar libsndfile.so.1 libsndfile1 (>= 1.0.20) libsndfile.so.1.0@libsndfile.so.1.0 1.0.20 sf_close@libsndfile.so.1.0 1.0.20 sf_command@libsndfile.so.1.0 1.0.20 sf_error@libsndfile.so.1.0 1.0.20 sf_error_number@libsndfile.so.1.0 1.0.20 sf_error_str@libsndfile.so.1.0 1.0.20 sf_format_check@libsndfile.so.1.0 1.0.20 sf_get_string@libsndfile.so.1.0 1.0.20 sf_open@libsndfile.so.1.0 1.0.20 sf_open_fd@libsndfile.so.1.0 1.0.20 sf_open_virtual@libsndfile.so.1.0 1.0.20 sf_perror@libsndfile.so.1.0 1.0.20 sf_read_double@libsndfile.so.1.0 1.0.20 sf_read_float@libsndfile.so.1.0 1.0.20 sf_read_int@libsndfile.so.1.0 1.0.20 sf_read_raw@libsndfile.so.1.0 1.0.20 sf_read_short@libsndfile.so.1.0 1.0.20 sf_readf_double@libsndfile.so.1.0 1.0.20 sf_readf_float@libsndfile.so.1.0 1.0.20 sf_readf_int@libsndfile.so.1.0 1.0.20 sf_readf_short@libsndfile.so.1.0 1.0.20 sf_seek@libsndfile.so.1.0 1.0.20 sf_set_string@libsndfile.so.1.0 1.0.20 sf_strerror@libsndfile.so.1.0 1.0.20 sf_version_string@libsndfile.so.1.0 1.0.20 sf_write_double@libsndfile.so.1.0 1.0.20 sf_write_float@libsndfile.so.1.0 1.0.20 sf_write_int@libsndfile.so.1.0 1.0.20 sf_write_raw@libsndfile.so.1.0 1.0.20 sf_write_short@libsndfile.so.1.0 1.0.20 sf_write_sync@libsndfile.so.1.0 1.0.20 sf_writef_double@libsndfile.so.1.0 1.0.20 sf_writef_float@libsndfile.so.1.0 1.0.20 sf_writef_int@libsndfile.so.1.0 1.0.20 sf_writef_short@libsndfile.so.1.0 1.0.20 debian/changelog0000664000000000000000000003700013113544104011036 0ustar libsndfile (1.0.25-7ubuntu2.2) trusty-security; urgency=medium * SECURITY UPDATE: multiple security issues - debian/patches/*: synchronize security fixes with Debian's 1.0.25-9.1+deb7u2 release. Thanks! - CVE-2017-7585, CVE-2017-7586, CVE-2017-7741, CVE-2017-7742, CVE-2017-8361, CVE-2017-8362, CVE-2017-8363, CVE-2017-8365 -- Marc Deslauriers Wed, 31 May 2017 09:42:28 -0400 libsndfile (1.0.25-7ubuntu2.1) trusty-security; urgency=medium * SECURITY UPDATE: denial of service via out-of-bounds read - debian/patches/CVE-2014-9496.patch: check map offset and rsrc marker in src/sd2.c. - CVE-2014-9496 * SECURITY UPDATE: denial of service via division-by-zero - debian/patches/CVE-2014-9756.patch: check bytes and items in src/file_io.c. - CVE-2014-9756 * SECURITY UPDATE: heap overflow via AIFF file headindex value - debian/patches/CVE-2015-7805.patch: use headend in src/common.c. - CVE-2015-7805 -- Marc Deslauriers Mon, 07 Dec 2015 10:01:39 -0500 libsndfile (1.0.25-7ubuntu2) trusty; urgency=medium * Build with dh-autoreconf for new libtool. -- William Grant Sun, 15 Dec 2013 06:30:11 +0000 libsndfile (1.0.25-7ubuntu1) saucy; urgency=low * Update config.{guess,sub} for AArch64. -- Matthias Klose Tue, 13 Aug 2013 14:11:45 +0200 libsndfile (1.0.25-7) unstable; urgency=low * debian/control debian/rules Create -dbg versions of libsndfile1 and sndfile-programs binary packages. -- Erik de Castro Lopo Sat, 13 Jul 2013 18:48:35 +1000 libsndfile (1.0.25-6) unstable; urgency=low * debian/patches/01_sd2_rsrc_segfault.diff : Patch from upstream git. * debian/rules : Remove cruft at end of ifeq line. * debian/control : Remove DM-Upload-Allowed which no longer works. -- Erik de Castro Lopo Fri, 28 Jun 2013 17:39:23 +1000 libsndfile (1.0.25-5) unstable; urgency=low * debian/libsndfile1-dev: Do not install libsndfile.la (Closes: #670420). * debian/control: Standards version 3.9.3. No changes needed. -- Erik de Castro Lopo Mon, 18 Jun 2012 19:22:57 +1000 libsndfile (1.0.25-4) unstable; urgency=low * Patch from Moritz Muehlenhoff enabling harden build flags (Closes: #654831). -- Erik de Castro Lopo Fri, 6 Jan 2012 21:19:17 +1100 libsndfile (1.0.25-3) unstable; urgency=low * Patch from Steve Langasek to enable multiarch (Closes: #637585). -- Erik de Castro Lopo Sat, 13 Aug 2011 09:01:35 +1000 libsndfile (1.0.25-2) unstable; urgency=low * debian/control: Use linux-any dpkg architecture wildcard (Closes: #634492). -- Erik de Castro Lopo Tue, 19 Jul 2011 18:40:14 +1000 libsndfile (1.0.25-1) unstable; urgency=low * New upstream. * debian/control: Update standards version (no changes needed). * debian/rules: Add build-indep and build-arch targets. -- Erik de Castro Lopo Mon, 18 Jul 2011 20:06:57 +1000 libsndfile (1.0.24-1) unstable; urgency=low * New upstream. -- Erik de Castro Lopo Wed, 23 Mar 2011 20:50:15 +1100 libsndfile (1.0.23-1) unstable; urgency=low * New upstream (Closes: #599145, #545257). -- Erik de Castro Lopo Sun, 10 Oct 2010 18:31:15 +1100 libsndfile (1.0.22-1) unstable; urgency=low * New upstream. * Remove debian/patches/01kfreebsd_symbols.diff (already in upstream). * Remove debian/patches/02flac_zero_len.diff (already in upstream). * debian/control : - Remove build-dep on autoconf and automake. - Standard version 3.9.1. -- Erik de Castro Lopo Mon, 4 Oct 2010 12:28:26 +1100 libsndfile (1.0.21-3) unstable; urgency=low * Add patch 02flac_zero_len.diff to make FLAC handler work on files of unknown length (FLAC metadata says 0 frames). (Closes: #590752). * debian/control : Standards version 3.9.0. -- Erik de Castro Lopo Mon, 2 Aug 2010 19:28:17 +1000 libsndfile (1.0.21-2) unstable; urgency=low * Patch configure.ac to generate symbols file for kfreebsd (Closes: 561086). * debian/control : Add build-dep on autoconf and automake (for autoreconf). * debian/rules : Run autoreconf before configure. -- Erik de Castro Lopo Tue, 15 Dec 2009 20:59:14 +1100 libsndfile (1.0.21-1) unstable; urgency=low * New upstream. * debian/rules : - Remove old man pages which are now in upstream package. - Remove old patches now in usptream. - sndfile-programs now recommends sndfile-tools. * debian/control : Updated long desription for sndfile-programs. -- Erik de Castro Lopo Mon, 14 Dec 2009 20:12:32 +1100 libsndfile (1.0.20-3) unstable; urgency=low * debian/rules : - Man pages belong to sndfile-programs. (Closes: #549972). - Make sure that test suite failures are not ignored. -- Erik de Castro Lopo Wed, 7 Oct 2009 06:56:20 +1100 libsndfile (1.0.20-2) unstable; urgency=low * debian/control : - New maintainer (Closes: #546787). - Add DM-Upload-Allowed yes. - Standards-Version: 3.8.3. - Depend on libvorbis >= 1.2.3. Version 1.2.0 gives weird results on some arches (eg PPC, MIPS) (Closes: #518037). * debian/copyright : - Add missing license info (Closes: #532448). * debian/rules : - Clear dependency_libs field of libsndfile.la (Closes: #539889). * debian/patches/ debian/rules debian/control : - Use quilt instead of dpatch. * Add file debian/README.source * Add patch debian/patches/02man_sndfile_convert.diff to fix man page lintian warning. * Add three new manpages. -- Erik de Castro Lopo Tue, 6 Oct 2009 21:34:58 +1100 libsndfile (1.0.20-1) unstable; urgency=low * New upstream release. * Fixes potential heap overflows on VOC and AIFF files, closes: #528650. -- Samuel Mimram Tue, 19 May 2009 09:13:56 +0200 libsndfile (1.0.19-2) unstable; urgency=low * Ignore failures of check since it causes too many false negatives, closes: #518037, #519338. * Update standards version to 3.8.1. -- Samuel Mimram Mon, 16 Mar 2009 09:44:42 +0100 libsndfile (1.0.19-1) unstable; urgency=low * New upstream release. - Adds back flac support, closes: #517224. -- Samuel Mimram Tue, 03 Mar 2009 09:36:10 +0100 libsndfile (1.0.18-2) unstable; urgency=low * Add missing build-dependencies on pkg-config and libvorbis-dev. -- Samuel Mimram Tue, 17 Feb 2009 19:21:03 +0100 libsndfile (1.0.18-1) unstable; urgency=low * New upstream release. - Corrected error messages in libsndfile, closes: #481833. * Removed flac-1.1.4.dpatch and overflow.dpatch, integrated upstream. * Updated lossy_comp_test-overflow.dpatch and sndfile-play-kfreebsd.dpatch. * Updated compat to 7. * Updated standards version to 3.8.0. * Put homepage in headers instead of description. -- Samuel Mimram Mon, 16 Feb 2009 10:13:44 +0100 libsndfile (1.0.17-4) unstable; urgency=low * Added overflow.dpatch to fix a possible heap-based buffer overflow (CVE-2007-4974), closes: #443386. -- Samuel Mimram Thu, 20 Sep 2007 23:40:17 +0000 libsndfile (1.0.17-3) unstable; urgency=low * Version dependencies on libflac-dev, closes: #431140. -- Samuel Mimram Sat, 30 Jun 2007 17:05:38 +0200 libsndfile (1.0.17-2) unstable; urgency=low * Added flac-1.1.4.dpatch to adapt to the new FLAC API, closes: #426676. * Don't build-depend on libasound2-dev on hurd, closes: #426795. -- Samuel Mimram Fri, 15 Jun 2007 12:41:00 +0200 libsndfile (1.0.17-1) unstable; urgency=low * Adopting the package, closes: #418082. * New upstream release, closes: #407635. * Big-endian architectures should now correctly be handled by sndfile-play, closes: #350807. * Using dpatch to handle patches. * Added lossy_comp_test-overflow.dpatch to prevent a possible overflow in the tests when compiled with gcc 4.2, closes: #362414. * Added sndfile-play-kfreebsd.dpatch to make sndfile-play work on kfreebsd, closes: #376525. -- Samuel Mimram Sat, 07 Apr 2007 13:07:14 +0200 libsndfile (1.0.16-1) unstable; urgency=low * New upstream release * Update standards version (no changes required) -- Anand Kumria Mon, 3 Jul 2006 20:24:54 +1000 libsndfile (1.0.15-3) unstable; urgency=low * Depend on libasound2-dev so we use ALSA for the example programs rather than (potentially) using OSS. Should fix #350807 but I'll wait until the reporter confirms this before closing. -- Anand Kumria Mon, 24 Apr 2006 22:21:00 +1000 libsndfile (1.0.15-2) unstable; urgency=medium * Pull changes from 1.0.16pre1 for src/aiff.c so we can build on m68k (Closes: #359325) -- Anand Kumria Wed, 29 Mar 2006 23:07:45 +1100 libsndfile (1.0.15-1) unstable; urgency=low * New upstream release * Fix ia64 compilation issues (and possible ARM and m68k) * Add RIFX support -- Anand Kumria Fri, 17 Mar 2006 11:32:16 +1100 libsndfile (1.0.14-1) unstable; urgency=low * New upstream release -- Anand Kumria Tue, 21 Feb 2006 22:20:26 +1100 libsndfile (1.0.13-1) unstable; urgency=low * New upstream release * Add reading/writing of instrument chunks to WAV and AIFF files * Support G721 / G610 coded WAV files -- Anand Kumria Mon, 23 Jan 2006 08:35:00 +1100 libsndfile (1.0.12-3) unstable; urgency=medium * Add dependancy on libflac-dev to libsndfile1-dev (Closes: #332591) -- Anand Kumria Sat, 8 Oct 2005 14:32:56 +1000 libsndfile (1.0.12-2) unstable; urgency=low * Depend on libflac7 (Closes: #331040) -- Anand Kumria Sat, 01 Oct 2005 20:15:28 +1000 libsndfile (1.0.12-1) unstable; urgency=low * New upstream release * Upstream has updated config.sub/config.guess (Closes: #328147) * Upstream now supports Ogg Flac, so depend on libflac-dev * Update to standards version 3.6.2.1 -- Anand Kumria Fri, 30 Sep 2005 15:57:54 +1000 libsndfile (1.0.11-1) unstable; urgency=low * New upstream release -- Anand Kumria Sun, 17 Jul 2005 01:00:59 +1000 libsndfile (1.0.10-2) unstable; urgency=medium * Patch from upstream to correct flaw in sndfile-progs * Corrects sndfile-convert (closes: #271999) -- Anand Kumria Sat, 18 Sep 2004 04:33:42 +1000 libsndfile (1.0.10-1) unstable; urgency=low * New upstream release * Slightly different patch from upstream to correct #253490 * bugfixes to AIFF/WAV read/write * hardier testsuite * 1.0.9 were accidently uploaded as Debian native. Fix that. -- Anand Kumria Thu, 17 Jun 2004 00:05:56 +1000 libsndfile (1.0.9-2) unstable; urgency=low * Apply patch from Andreas Jochens to correctly cast to size_t various arguments (closes: #253490) -- Anand Kumria Wed, 16 Jun 2004 23:41:36 +1000 libsndfile (1.0.9-1) unstable; urgency=low * New upstream release (closes: #252770) -- Anand Kumria Sun, 6 Jun 2004 00:11:41 +1000 libsndfile (1.0.8-1) unstable; urgency=low * New upstream release -- Anand Kumria Sun, 28 Mar 2004 17:04:57 +1000 libsndfile (1.0.7-1) unstable; urgency=medium * New upstream releasea * detects how the CPU clips and acts appropriately. (closes: #233970) -- Anand Kumria Sat, 28 Feb 2004 05:36:42 +1100 Libsndfile (1.0.6-1) unstable; urgency=low * New upstream release (closes: #223940) * New maintainer (thanks Joshua!) * Provide virtual package libsndfile-dev (closes: #200931) -- Anand Kumria Sun, 15 Feb 2004 00:52:53 +1100 libsndfile (1.0.4-3) unstable; urgency=low * Oops; forgot section change from devel to libdevel -- Joshua Haberman Sun, 27 Apr 2003 21:42:49 +0000 libsndfile (1.0.4-2) unstable; urgency=low * Fix from upstream to fix string_test from 'make check' on m68k (closes: #180377) -- Joshua Haberman Sun, 27 Apr 2003 21:22:28 +0000 libsndfile (1.0.4-1) unstable; urgency=low * New upstream release -- Joshua Haberman Sat, 8 Feb 2003 23:14:17 +0000 libsndfile (1.0.3-1) unstable; urgency=low * New upstream release - "make check" should no longer fail on Alpha - "make check" should no longer fail on ia64 (closes: #161090) -- Joshua Haberman Sun, 8 Dec 2002 23:56:03 -0800 libsndfile (1.0.2-1) unstable; urgency=low * New upstream release - "make check" should no longer fail on ARM (closes: #168424) - though progress has been made on the ia64 problems, they have not been fully resolved, so I am not closing #161090. - interfaces have been added, (new sf_command SFC_GET_FORMAT_INFO) so I am bumping the shlibs version to (>= this release) -- Joshua Haberman Sun, 1 Dec 2002 21:08:51 -0800 libsndfile (1.0.0-1) unstable; urgency=low * New upstream release (closes: #144821, #144897) - The bump in sonumber makes for new binary packages libsndfile1 and libsndfile1-dev * New maintainer, with blessings from previous maintainer and upstream * The -dev package now uses and depends on pkg-config instead of including a separate program 'sndfile-config' * Associated programs 'sndfile-info' and 'sndfile-play' moved to separate package 'sndfile-programs' * DH_COMPAT=4 * Standards-Version: 3.5.6.1 -- Joshua Haberman Sat, 8 Jun 2002 19:56:23 -0700 libsndfile (0.0.26-1.1) unstable; urgency=high * NMU with permission of Hwei Sheng Teoh. * Added a build conflict with automake. (closes: #120218) -- Adrian Bunk Fri, 7 Dec 2001 09:24:43 +0100 libsndfile (0.0.26-1) unstable; urgency=low * New upstream release * Merged fixes by Jeff Licquia : - Added Build-Depends on debhelper. Closes: #104308. - Use autoconf endian test instead of the silly architecture lists. - Fixed build problem w/ CAN_READ_WRITE_x86_IEEE on ia64 and arm. Closes: #105136. -- Hwei Sheng Teoh Mon, 22 Oct 2001 19:31:32 -0400 libsndfile (0.0.22-2.1) unstable; urgency=low * Run libtoolize to get support for new architectures. Closes: #95080 -- LaMont Jones Mon, 9 Jul 2001 21:39:34 -0600 libsndfile (0.0.22-2) unstable; urgency=low * Changed documention section of libsndfile-dev to "Programming" (Closes: #79458). -- Hwei Sheng Teoh Wed, 13 Dec 2000 10:29:13 -0500 libsndfile (0.0.22-1) unstable; urgency=low * New upstream release -- Hwei Sheng Teoh Wed, 6 Dec 2000 09:09:51 -0500 libsndfile (0.0.21-2) unstable; urgency=low * Fixed: missing section lines in debian/control for libsndfile0 * Removed questionable text about MP3's from package description. -- Hwei Sheng Teoh Mon, 4 Sep 2000 17:00:41 -0400 libsndfile (0.0.21-1) unstable; urgency=low * Initial Release. * Converted to DH_COMPAT=2. Not sure why dh_make defaults to DH_COMPAT=1 even in the pristine source tree (is this a bug in debhelper?) * Fixed debian/rules to properly produce changelogs in binary packages -- Hwei Sheng Teoh Mon, 28 Aug 2000 12:41:14 -0400 debian/sndfile-interleave.10000664000000000000000000000135512170473033013036 0ustar .TH SNDFILE-INTERLEAVE 1 "December 14, 2009" .SH NAME sndfile-interleave \- convert multiple single channel files into a multi-channel file .br sndfile-deinterleave \- split a multi-channel into multiple single channel files .SH SYNOPSIS .B sndfile-interleave .RI " ... -o " .br .B sndfile-deinterleave .RI "filename" .SH DESCRIPTION sndfile-interleave and sndfile-deinterleave use libsndfile (http://www.mega-nerd.com/libsndfile/) to convert back and forth between multiple single channel files and a single multi-channel sound file. Run "sndfile\-interleave \-\-help" or "sndfile\-deinterleave \-\-help" for more information .SH AUTHOR This manual page was written by Erik de Castro Lopo . debian/source/0000775000000000000000000000000012170473033010470 5ustar debian/source/format0000664000000000000000000000001412170473033011676 0ustar 3.0 (quilt) debian/compat0000664000000000000000000000000212170473033010366 0ustar 7 debian/libsndfile1-dev.examples0000664000000000000000000000003712170473033013700 0ustar examples/*.c examples/Makefile debian/patches/0000775000000000000000000000000013113544131010613 5ustar debian/patches/00lossy_comp_test-overflow.diff0000664000000000000000000000140312170473033016676 0ustar #! /bin/sh /usr/share/dpatch/dpatch-run ## lossy_comp_test-overflow.dpatch by Martin Michlmayr ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Avoid a possible overflow in sum_abs. ## DP: See #362414. @DPATCH@ diff -urNad libsndfile-1.0.18~/tests/fix_this.c libsndfile-1.0.18/tests/fix_this.c --- libsndfile-1.0.18~/tests/fix_this.c 2009-02-07 05:05:20.000000000 +0100 +++ libsndfile-1.0.18/tests/fix_this.c 2009-02-16 09:58:08.000000000 +0100 @@ -69,7 +69,8 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double margin) { SNDFILE *file ; SF_INFO sfinfo ; - int k, m, *orig, *data, sum_abs ; + int k, m, *orig, *data ; + long long sum_abs ; long datalen, seekpos ; double scale ; debian/patches/CVE-2014-9756.patch0000664000000000000000000000121512631317512013251 0ustar commit 725c7dbb95bfaf8b4bb7b04820e3a00cceea9ce6 Author: Erik de Castro Lopo Date: Wed Dec 24 21:02:35 2014 +1100 src/file_io.c : Prevent potential divide-by-zero. Closes: https://github.com/erikd/libsndfile/issues/92 Index: libsndfile-1.0.25/src/file_io.c =================================================================== --- libsndfile-1.0.25.orig/src/file_io.c +++ libsndfile-1.0.25/src/file_io.c @@ -358,6 +358,9 @@ { sf_count_t total = 0 ; ssize_t count ; + if (bytes == 0 || items == 0) + return 0 ; + if (psf->virtual_io) return psf->vio.write (ptr, bytes*items, psf->vio_user_data) / bytes ; debian/patches/CVE-2017-7585-CVE-2017-7586-CVE-2017-7741.patch0000664000000000000000000005534013077651715016310 0ustar Description: fixes buffer write overflows This patch was backported from Debian sid to wheezy's 1.0.25 release and (verifiably) fixes CVE-2017-7741 and (presumably) CVE-2017-7585 and CVE-2017-7586 (they lack reproducers). Author: Erik de Castro Lopo Origin: upstream Applied-Upstream: 1.0.28 Reviewed-by: IOhannes m zmölnig Last-Update: 2017-04-03 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/src/id3.c +++ b/src/id3.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 2010-2011 Erik de Castro Lopo +** Copyright (C) 2010-2017 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU Lesser General Public License as published by @@ -40,12 +40,17 @@ id3_skip (SF_PRIVATE * psf) offset = (offset << 7) | (buf [8] & 0x7f) ; offset = (offset << 7) | (buf [9] & 0x7f) ; - psf_binheader_readf (psf, "j", make_size_t (offset)) ; - psf_log_printf (psf, "ID3 length : %d\n--------------------\n", offset) ; + /* Never want to jump backwards in a file. */ + if (offset < 0) + return 0 ; + psf->fileoffset = 10 + offset ; - return 1 ; + if (psf->fileoffset < psf->filelength) + { psf_binheader_readf (psf, "p", psf->fileoffset) ; + return 1 ; + } ; } ; return 0 ; --- a/src/flac.c +++ b/src/flac.c @@ -59,10 +59,10 @@ typedef struct FLAC__StreamMetadata *metadata ; - const FLAC__int32 * const * wbuffer ; - FLAC__int32 * rbuffer [FLAC__MAX_CHANNELS] ; + const int32_t * const * wbuffer ; + int32_t * rbuffer [FLAC__MAX_CHANNELS] ; - FLAC__int32* encbuffer ; + int32_t* encbuffer ; unsigned bufferpos ; const FLAC__Frame *frame ; @@ -90,18 +90,18 @@ static sf_count_t flac_write_i2flac (SF_ static sf_count_t flac_write_f2flac (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ; static sf_count_t flac_write_d2flac (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ; -static void f2flac8_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; -static void f2flac16_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; -static void f2flac24_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; -static void f2flac8_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; -static void f2flac16_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; -static void f2flac24_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; -static void d2flac8_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; -static void d2flac16_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; -static void d2flac24_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; -static void d2flac8_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; -static void d2flac16_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; -static void d2flac24_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; +static void f2flac8_array (const float *src, int32_t *dest, int count, int normalize) ; +static void f2flac16_array (const float *src, int32_t *dest, int count, int normalize) ; +static void f2flac24_array (const float *src, int32_t *dest, int count, int normalize) ; +static void f2flac8_clip_array (const float *src, int32_t *dest, int count, int normalize) ; +static void f2flac16_clip_array (const float *src, int32_t *dest, int count, int normalize) ; +static void f2flac24_clip_array (const float *src, int32_t *dest, int count, int normalize) ; +static void d2flac8_array (const double *src, int32_t *dest, int count, int normalize) ; +static void d2flac16_array (const double *src, int32_t *dest, int count, int normalize) ; +static void d2flac24_array (const double *src, int32_t *dest, int count, int normalize) ; +static void d2flac8_clip_array (const double *src, int32_t *dest, int count, int normalize) ; +static void d2flac16_clip_array (const double *src, int32_t *dest, int count, int normalize) ; +static void d2flac24_clip_array (const double *src, int32_t *dest, int count, int normalize) ; static int flac_command (SF_PRIVATE *psf, int command, void *data, int datasize) ; @@ -111,7 +111,7 @@ static FLAC__StreamDecoderSeekStatus sf_ static FLAC__StreamDecoderTellStatus sf_flac_tell_callback (const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ; static FLAC__StreamDecoderLengthStatus sf_flac_length_callback (const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) ; static FLAC__bool sf_flac_eof_callback (const FLAC__StreamDecoder *decoder, void *client_data) ; -static FLAC__StreamDecoderWriteStatus sf_flac_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) ; +static FLAC__StreamDecoderWriteStatus sf_flac_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const int32_t * const buffer [], void *client_data) ; static void sf_flac_meta_callback (const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) ; static void sf_flac_error_callback (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) ; @@ -121,38 +121,38 @@ static FLAC__StreamEncoderTellStatus sf_ static FLAC__StreamEncoderWriteStatus sf_flac_enc_write_callback (const FLAC__StreamEncoder *encoder, const FLAC__byte buffer [], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) ; static void -s2flac8_array (const short *src, FLAC__int32 *dest, int count) +s2flac8_array (const short *src, int32_t *dest, int count) { while (--count >= 0) dest [count] = src [count] >> 8 ; } /* s2flac8_array */ static void -s2flac16_array (const short *src, FLAC__int32 *dest, int count) +s2flac16_array (const short *src, int32_t *dest, int count) { while (--count >= 0) dest [count] = src [count] ; } /* s2flac16_array */ static void -s2flac24_array (const short *src, FLAC__int32 *dest, int count) +s2flac24_array (const short *src, int32_t *dest, int count) { while (--count >= 0) dest [count] = src [count] << 8 ; } /* s2flac24_array */ static void -i2flac8_array (const int *src, FLAC__int32 *dest, int count) +i2flac8_array (const int *src, int32_t *dest, int count) { while (--count >= 0) dest [count] = src [count] >> 24 ; } /* i2flac8_array */ static void -i2flac16_array (const int *src, FLAC__int32 *dest, int count) +i2flac16_array (const int *src, int32_t *dest, int count) { while (--count >= 0) dest [count] = src [count] >> 16 ; } /* i2flac16_array */ static void -i2flac24_array (const int *src, FLAC__int32 *dest, int count) +i2flac24_array (const int *src, int32_t *dest, int count) { while (--count >= 0) dest [count] = src [count] >> 8 ; } /* i2flac24_array */ @@ -161,8 +161,8 @@ static sf_count_t flac_buffer_copy (SF_PRIVATE *psf) { FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; const FLAC__Frame *frame = pflac->frame ; - const FLAC__int32* const *buffer = pflac->wbuffer ; - unsigned i = 0, j, offset ; + const int32_t* const *buffer = pflac->wbuffer ; + unsigned i = 0, j, offset, channels, len ; /* ** frame->header.blocksize is variable and we're using a constant blocksize @@ -174,6 +174,10 @@ flac_buffer_copy (SF_PRIVATE *psf) psf->error = SFE_INTERNAL ; return 0 ; } ; + if (frame->header.channels > FLAC__MAX_CHANNELS) + psf_log_printf (psf, "Ooops : frame->header.channels (%d) > FLAC__MAX_BLOCK_SIZE (%d)\n", __func__, __LINE__, frame->header.channels, FLAC__MAX_CHANNELS) ; + + channels = SF_MIN (frame->header.channels, FLAC__MAX_CHANNELS) ; if (pflac->ptr == NULL) { /* @@ -181,47 +185,55 @@ flac_buffer_copy (SF_PRIVATE *psf) ** Removing it causes valgrind errors. */ pflac->bufferbackup = SF_TRUE ; - for (i = 0 ; i < frame->header.channels ; i++) + for (i = 0 ; i < channels ; i++) { if (pflac->rbuffer [i] == NULL) - pflac->rbuffer [i] = calloc (FLAC__MAX_BLOCK_SIZE, sizeof (FLAC__int32)) ; + pflac->rbuffer [i] = calloc (FLAC__MAX_BLOCK_SIZE, sizeof (int32_t)) ; - memcpy (pflac->rbuffer [i], buffer [i], frame->header.blocksize * sizeof (FLAC__int32)) ; + memcpy (pflac->rbuffer [i], buffer [i], frame->header.blocksize * sizeof (int32_t)) ; } ; - pflac->wbuffer = (const FLAC__int32* const*) pflac->rbuffer ; + pflac->wbuffer = (const int32_t* const*) pflac->rbuffer ; return 0 ; } ; + len = SF_MIN (pflac->len, frame->header.blocksize) ; + switch (pflac->pcmtype) { case PFLAC_PCM_SHORT : { short *retpcm = (short*) pflac->ptr ; int shift = 16 - frame->header.bits_per_sample ; if (shift < 0) { shift = abs (shift) ; - for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) - { offset = pflac->pos + i * frame->header.channels ; + for (i = 0 ; i < len && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * channels ; if (pflac->bufferpos >= frame->header.blocksize) break ; - for (j = 0 ; j < frame->header.channels ; j++) + if (offset + channels > pflac->len) + break ; + + for (j = 0 ; j < channels ; j++) retpcm [offset + j] = buffer [j][pflac->bufferpos] >> shift ; - pflac->remain -= frame->header.channels ; + pflac->remain -= channels ; pflac->bufferpos++ ; } } else - { for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) - { offset = pflac->pos + i * frame->header.channels ; + { for (i = 0 ; i < len && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * channels ; if (pflac->bufferpos >= frame->header.blocksize) break ; - for (j = 0 ; j < frame->header.channels ; j++) + if (offset + channels > pflac->len) + break ; + + for (j = 0 ; j < channels ; j++) retpcm [offset + j] = (buffer [j][pflac->bufferpos]) << shift ; - pflac->remain -= frame->header.channels ; + pflac->remain -= channels ; pflac->bufferpos++ ; } ; } ; @@ -231,15 +243,18 @@ flac_buffer_copy (SF_PRIVATE *psf) case PFLAC_PCM_INT : { int *retpcm = (int*) pflac->ptr ; int shift = 32 - frame->header.bits_per_sample ; - for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) - { offset = pflac->pos + i * frame->header.channels ; + for (i = 0 ; i < len && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * channels ; if (pflac->bufferpos >= frame->header.blocksize) break ; - for (j = 0 ; j < frame->header.channels ; j++) + if (offset + channels > pflac->len) + break ; + + for (j = 0 ; j < channels ; j++) retpcm [offset + j] = buffer [j][pflac->bufferpos] << shift ; - pflac->remain -= frame->header.channels ; + pflac->remain -= channels ; pflac->bufferpos++ ; } ; } ; @@ -249,15 +264,18 @@ flac_buffer_copy (SF_PRIVATE *psf) { float *retpcm = (float*) pflac->ptr ; float norm = (psf->norm_float == SF_TRUE) ? 1.0 / (1 << (frame->header.bits_per_sample - 1)) : 1.0 ; - for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) - { offset = pflac->pos + i * frame->header.channels ; + for (i = 0 ; i < len && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * channels ; if (pflac->bufferpos >= frame->header.blocksize) break ; - for (j = 0 ; j < frame->header.channels ; j++) + if (offset + channels > pflac->len) + break ; + + for (j = 0 ; j < channels ; j++) retpcm [offset + j] = buffer [j][pflac->bufferpos] * norm ; - pflac->remain -= frame->header.channels ; + pflac->remain -= channels ; pflac->bufferpos++ ; } ; } ; @@ -267,15 +285,18 @@ flac_buffer_copy (SF_PRIVATE *psf) { double *retpcm = (double*) pflac->ptr ; double norm = (psf->norm_double == SF_TRUE) ? 1.0 / (1 << (frame->header.bits_per_sample - 1)) : 1.0 ; - for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) - { offset = pflac->pos + i * frame->header.channels ; + for (i = 0 ; i < len && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * channels ; if (pflac->bufferpos >= frame->header.blocksize) break ; - for (j = 0 ; j < frame->header.channels ; j++) + if (offset + channels > pflac->len) + break ; + + for (j = 0 ; j < channels ; j++) retpcm [offset + j] = buffer [j][pflac->bufferpos] * norm ; - pflac->remain -= frame->header.channels ; + pflac->remain -= channels ; pflac->bufferpos++ ; } ; } ; @@ -285,8 +306,8 @@ flac_buffer_copy (SF_PRIVATE *psf) return 0 ; } ; - offset = i * frame->header.channels ; - pflac->pos += i * frame->header.channels ; + offset = i * channels ; + pflac->pos += i * channels ; return offset ; } /* flac_buffer_copy */ @@ -346,7 +367,7 @@ sf_flac_eof_callback (const FLAC__Stream } /* sf_flac_eof_callback */ static FLAC__StreamDecoderWriteStatus -sf_flac_write_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) +sf_flac_write_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC__Frame *frame, const int32_t * const buffer [], void *client_data) { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; @@ -363,7 +384,7 @@ sf_flac_write_callback (const FLAC__Stre static void sf_flac_meta_get_vorbiscomments (SF_PRIVATE *psf, const FLAC__StreamMetadata *metadata) -{ FLAC_TAG tags [] = +{ static FLAC_TAG tags [] = { { "title", SF_STR_TITLE }, { "copyright", SF_STR_COPYRIGHT }, { "software", SF_STR_SOFTWARE }, @@ -399,7 +420,8 @@ sf_flac_meta_get_vorbiscomments (SF_PRIV static void sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC__StreamMetadata *metadata, void *client_data) { SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; - int bitwidth = 0 ; + FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; + int bitwidth = 0, i ; switch (metadata->type) { case FLAC__METADATA_TYPE_STREAMINFO : @@ -436,6 +458,12 @@ sf_flac_meta_callback (const FLAC__Strea if (bitwidth > 0) psf_log_printf (psf, " Bit width : %d\n", bitwidth) ; + + + for (i = 0 ; i < psf->sf.channels ; i++) + pflac->rbuffer [i] = calloc (FLAC__MAX_BLOCK_SIZE, sizeof (int32_t)) ; + + pflac->wbuffer = (const int32_t* const*) pflac->rbuffer ; break ; case FLAC__METADATA_TYPE_VORBIS_COMMENT : @@ -612,7 +640,7 @@ flac_write_header (SF_PRIVATE *psf, int if (psf->error == 0) psf->dataoffset = psf_ftell (psf) ; - pflac->encbuffer = calloc (ENC_BUFFER_SIZE, sizeof (FLAC__int32)) ; + pflac->encbuffer = calloc (ENC_BUFFER_SIZE, sizeof (int32_t)) ; return psf->error ; } /* flac_write_header */ @@ -839,9 +867,12 @@ flac_read_loop (SF_PRIVATE *psf, unsigne pflac->pos = 0 ; pflac->len = len ; pflac->remain = len ; + + /* First copy data that has already been decoded and buffered. */ if (pflac->frame != NULL && pflac->bufferpos < pflac->frame->header.blocksize) flac_buffer_copy (psf) ; + /* Decode some more. */ while (pflac->pos < pflac->len) { if (FLAC__stream_decoder_process_single (pflac->fsd) == 0) break ; @@ -925,6 +956,7 @@ flac_read_flac2d (SF_PRIVATE *psf, doubl while (total < len) { pflac->ptr = ptr + total ; readlen = (len - total > 0x1000000) ? 0x1000000 : (unsigned) (len - total) ; + current = flac_read_loop (psf, readlen) ; if (current == 0) break ; @@ -937,10 +969,10 @@ flac_read_flac2d (SF_PRIVATE *psf, doubl static sf_count_t flac_write_s2flac (SF_PRIVATE *psf, const short *ptr, sf_count_t len) { FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; - void (*convert) (const short *, FLAC__int32 *, int) ; + void (*convert) (const short *, int32_t *, int) ; int bufferlen, writecount, thiswrite ; sf_count_t total = 0 ; - FLAC__int32* buffer = pflac->encbuffer ; + int32_t* buffer = pflac->encbuffer ; switch (SF_CODEC (psf->sf.format)) { case SF_FORMAT_PCM_S8 : @@ -956,7 +988,7 @@ flac_write_s2flac (SF_PRIVATE *psf, cons return -1 ; } ; - bufferlen = ENC_BUFFER_SIZE / (sizeof (FLAC__int32) * psf->sf.channels) ; + bufferlen = ENC_BUFFER_SIZE / (sizeof (int32_t) * psf->sf.channels) ; bufferlen *= psf->sf.channels ; while (len > 0) @@ -979,10 +1011,10 @@ flac_write_s2flac (SF_PRIVATE *psf, cons static sf_count_t flac_write_i2flac (SF_PRIVATE *psf, const int *ptr, sf_count_t len) { FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; - void (*convert) (const int *, FLAC__int32 *, int) ; + void (*convert) (const int *, int32_t *, int) ; int bufferlen, writecount, thiswrite ; sf_count_t total = 0 ; - FLAC__int32* buffer = pflac->encbuffer ; + int32_t* buffer = pflac->encbuffer ; switch (SF_CODEC (psf->sf.format)) { case SF_FORMAT_PCM_S8 : @@ -998,7 +1030,7 @@ flac_write_i2flac (SF_PRIVATE *psf, cons return -1 ; } ; - bufferlen = ENC_BUFFER_SIZE / (sizeof (FLAC__int32) * psf->sf.channels) ; + bufferlen = ENC_BUFFER_SIZE / (sizeof (int32_t) * psf->sf.channels) ; bufferlen *= psf->sf.channels ; while (len > 0) @@ -1021,10 +1053,10 @@ flac_write_i2flac (SF_PRIVATE *psf, cons static sf_count_t flac_write_f2flac (SF_PRIVATE *psf, const float *ptr, sf_count_t len) { FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; - void (*convert) (const float *, FLAC__int32 *, int, int) ; + void (*convert) (const float *, int32_t *, int, int) ; int bufferlen, writecount, thiswrite ; sf_count_t total = 0 ; - FLAC__int32* buffer = pflac->encbuffer ; + int32_t* buffer = pflac->encbuffer ; switch (SF_CODEC (psf->sf.format)) { case SF_FORMAT_PCM_S8 : @@ -1040,7 +1072,7 @@ flac_write_f2flac (SF_PRIVATE *psf, cons return -1 ; } ; - bufferlen = ENC_BUFFER_SIZE / (sizeof (FLAC__int32) * psf->sf.channels) ; + bufferlen = ENC_BUFFER_SIZE / (sizeof (int32_t) * psf->sf.channels) ; bufferlen *= psf->sf.channels ; while (len > 0) @@ -1061,7 +1093,7 @@ flac_write_f2flac (SF_PRIVATE *psf, cons } /* flac_write_f2flac */ static void -f2flac8_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) +f2flac8_clip_array (const float *src, int32_t *dest, int count, int normalize) { float normfact, scaled_value ; normfact = normalize ? (8.0 * 0x10) : 1.0 ; @@ -1083,7 +1115,7 @@ f2flac8_clip_array (const float *src, FL } /* f2flac8_clip_array */ static void -f2flac16_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) +f2flac16_clip_array (const float *src, int32_t *dest, int count, int normalize) { float normfact, scaled_value ; @@ -1104,7 +1136,7 @@ f2flac16_clip_array (const float *src, F } /* f2flac16_clip_array */ static void -f2flac24_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) +f2flac24_clip_array (const float *src, int32_t *dest, int count, int normalize) { float normfact, scaled_value ; normfact = normalize ? (8.0 * 0x100000) : 1.0 ; @@ -1127,7 +1159,7 @@ f2flac24_clip_array (const float *src, F } /* f2flac24_clip_array */ static void -f2flac8_array (const float *src, FLAC__int32 *dest, int count, int normalize) +f2flac8_array (const float *src, int32_t *dest, int count, int normalize) { float normfact = normalize ? (1.0 * 0x7F) : 1.0 ; while (--count >= 0) @@ -1135,7 +1167,7 @@ f2flac8_array (const float *src, FLAC__i } /* f2flac8_array */ static void -f2flac16_array (const float *src, FLAC__int32 *dest, int count, int normalize) +f2flac16_array (const float *src, int32_t *dest, int count, int normalize) { float normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ; while (--count >= 0) @@ -1143,7 +1175,7 @@ f2flac16_array (const float *src, FLAC__ } /* f2flac16_array */ static void -f2flac24_array (const float *src, FLAC__int32 *dest, int count, int normalize) +f2flac24_array (const float *src, int32_t *dest, int count, int normalize) { float normfact = normalize ? (1.0 * 0x7FFFFF) : 1.0 ; while (--count >= 0) @@ -1153,10 +1185,10 @@ f2flac24_array (const float *src, FLAC__ static sf_count_t flac_write_d2flac (SF_PRIVATE *psf, const double *ptr, sf_count_t len) { FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; - void (*convert) (const double *, FLAC__int32 *, int, int) ; + void (*convert) (const double *, int32_t *, int, int) ; int bufferlen, writecount, thiswrite ; sf_count_t total = 0 ; - FLAC__int32* buffer = pflac->encbuffer ; + int32_t* buffer = pflac->encbuffer ; switch (SF_CODEC (psf->sf.format)) { case SF_FORMAT_PCM_S8 : @@ -1172,7 +1204,7 @@ flac_write_d2flac (SF_PRIVATE *psf, cons return -1 ; } ; - bufferlen = ENC_BUFFER_SIZE / (sizeof (FLAC__int32) * psf->sf.channels) ; + bufferlen = ENC_BUFFER_SIZE / (sizeof (int32_t) * psf->sf.channels) ; bufferlen *= psf->sf.channels ; while (len > 0) @@ -1193,7 +1225,7 @@ flac_write_d2flac (SF_PRIVATE *psf, cons } /* flac_write_d2flac */ static void -d2flac8_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) +d2flac8_clip_array (const double *src, int32_t *dest, int count, int normalize) { double normfact, scaled_value ; normfact = normalize ? (8.0 * 0x10) : 1.0 ; @@ -1215,7 +1247,7 @@ d2flac8_clip_array (const double *src, F } /* d2flac8_clip_array */ static void -d2flac16_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) +d2flac16_clip_array (const double *src, int32_t *dest, int count, int normalize) { double normfact, scaled_value ; normfact = normalize ? (8.0 * 0x1000) : 1.0 ; @@ -1237,7 +1269,7 @@ d2flac16_clip_array (const double *src, } /* d2flac16_clip_array */ static void -d2flac24_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) +d2flac24_clip_array (const double *src, int32_t *dest, int count, int normalize) { double normfact, scaled_value ; normfact = normalize ? (8.0 * 0x100000) : 1.0 ; @@ -1259,7 +1291,7 @@ d2flac24_clip_array (const double *src, } /* d2flac24_clip_array */ static void -d2flac8_array (const double *src, FLAC__int32 *dest, int count, int normalize) +d2flac8_array (const double *src, int32_t *dest, int count, int normalize) { double normfact = normalize ? (1.0 * 0x7F) : 1.0 ; while (--count >= 0) @@ -1267,7 +1299,7 @@ d2flac8_array (const double *src, FLAC__ } /* d2flac8_array */ static void -d2flac16_array (const double *src, FLAC__int32 *dest, int count, int normalize) +d2flac16_array (const double *src, int32_t *dest, int count, int normalize) { double normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ; while (--count >= 0) @@ -1275,7 +1307,7 @@ d2flac16_array (const double *src, FLAC_ } /* d2flac16_array */ static void -d2flac24_array (const double *src, FLAC__int32 *dest, int count, int normalize) +d2flac24_array (const double *src, int32_t *dest, int count, int normalize) { double normfact = normalize ? (1.0 * 0x7FFFFF) : 1.0 ; while (--count >= 0) debian/patches/CVE-2017-7742.patch0000664000000000000000000000561213077651715013265 0ustar From 60b234301adf258786d8b90be5c1d437fc8799e0 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Fri, 24 Mar 2017 20:51:59 +1100 Subject: [PATCH] src/flac.c: Improve error handling Especially when dealing with corrupt or malicious files. --- src/flac.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) --- a/src/flac.c +++ b/src/flac.c @@ -66,7 +66,6 @@ typedef struct unsigned bufferpos ; const FLAC__Frame *frame ; - FLAC__bool bufferbackup ; } FLAC_PRIVATE ; typedef struct @@ -181,10 +180,9 @@ flac_buffer_copy (SF_PRIVATE *psf) if (pflac->ptr == NULL) { /* - ** Not sure why this code is here and not elsewhere. - ** Removing it causes valgrind errors. + ** This pointer is reset to NULL each time the current frame has been + ** decoded. Somehow its used during encoding and decoding. */ - pflac->bufferbackup = SF_TRUE ; for (i = 0 ; i < channels ; i++) { if (pflac->rbuffer [i] == NULL) @@ -199,6 +197,11 @@ flac_buffer_copy (SF_PRIVATE *psf) len = SF_MIN (pflac->len, frame->header.blocksize) ; + if (pflac->remain % channels != 0) + { psf_log_printf (psf, "Error: pflac->remain %u channels %u\n", pflac->remain, channels) ; + return 0 ; + } ; + switch (pflac->pcmtype) { case PFLAC_PCM_SHORT : { short *retpcm = (short*) pflac->ptr ; @@ -374,7 +377,6 @@ sf_flac_write_callback (const FLAC__Stre pflac->frame = frame ; pflac->bufferpos = 0 ; - pflac->bufferbackup = SF_FALSE ; pflac->wbuffer = buffer ; flac_buffer_copy (psf) ; @@ -863,11 +865,19 @@ flac_init (SF_PRIVATE *psf) static unsigned flac_read_loop (SF_PRIVATE *psf, unsigned len) { FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ; + FLAC__StreamDecoderState state ; pflac->pos = 0 ; pflac->len = len ; pflac->remain = len ; + state = FLAC__stream_decoder_get_state (pflac->fsd) ; + if (state > FLAC__STREAM_DECODER_END_OF_STREAM) + { psf_log_printf (psf, "FLAC__stream_decoder_get_state returned %s\n", FLAC__StreamDecoderStateString [state]) ; + /* Current frame is busted, so NULL the pointer. */ + pflac->frame = NULL ; + } ; + /* First copy data that has already been decoded and buffered. */ if (pflac->frame != NULL && pflac->bufferpos < pflac->frame->header.blocksize) flac_buffer_copy (psf) ; @@ -876,8 +886,13 @@ flac_read_loop (SF_PRIVATE *psf, unsigne while (pflac->pos < pflac->len) { if (FLAC__stream_decoder_process_single (pflac->fsd) == 0) break ; - if (FLAC__stream_decoder_get_state (pflac->fsd) >= FLAC__STREAM_DECODER_END_OF_STREAM) + state = FLAC__stream_decoder_get_state (pflac->fsd) ; + if (state >= FLAC__STREAM_DECODER_END_OF_STREAM) + { psf_log_printf (psf, "FLAC__stream_decoder_get_state returned %s\n", FLAC__StreamDecoderStateString [state]) ; + /* Current frame is busted, so NULL the pointer. */ + pflac->frame = NULL ; break ; + } ; } ; pflac->ptr = NULL ; debian/patches/series0000664000000000000000000000042613113544137012040 0ustar 00lossy_comp_test-overflow.diff 01_sd2_rsrc_segfault.diff config-updates.diff CVE-2014-9496.patch CVE-2014-9756.patch CVE-2015-7805.patch CVE-2017-7585-CVE-2017-7586-CVE-2017-7741.patch CVE-2017-7742.patch CVE-2017-8361_8363_8365.patch CVE-2017-8363-2.patch CVE-2017-8362.patch debian/patches/CVE-2017-8363-2.patch0000664000000000000000000000077013112340731013403 0ustar Index: libsndfile-1.0.25/src/flac.c =================================================================== --- libsndfile-1.0.25.orig/src/flac.c 2017-05-27 20:13:41.382287617 +0200 +++ libsndfile-1.0.25/src/flac.c 2017-05-27 20:13:41.374287140 +0200 @@ -828,7 +828,9 @@ psf_log_printf (psf, "End\n") ; - if (psf->error == 0) + if (psf->error != 0) + FLAC__stream_decoder_delete (pflac->fsd) ; + else { FLAC__uint64 position ; FLAC__stream_decoder_get_decode_position (pflac->fsd, &position) ; debian/patches/config-updates.diff0000664000000000000000000014030112202421177014356 0ustar Index: b/Cfg/config.guess =================================================================== --- a/Cfg/config.guess +++ b/Cfg/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -# Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2009-04-27' +timestamp='2013-06-10' # 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 -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +15,22 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # 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. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner. # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,8 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -139,12 +132,33 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -170,7 +184,7 @@ arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -180,7 +194,7 @@ fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -201,6 +215,10 @@ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -223,7 +241,7 @@ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -269,7 +287,10 @@ # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -295,12 +316,12 @@ echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -333,6 +354,9 @@ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" @@ -391,23 +415,23 @@ # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -477,8 +501,8 @@ echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -491,7 +515,7 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -548,7 +572,7 @@ echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[456]) + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -591,52 +615,52 @@ 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -656,7 +680,7 @@ # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null + grep -q __LP64__ then HP_ARCH="hppa2.0w" else @@ -727,22 +751,22 @@ exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -766,14 +790,14 @@ exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -785,34 +809,39 @@ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in + *:Interix*:*) + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - EM64T | authenticamd | genuineintel) + authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -822,6 +851,9 @@ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -842,210 +874,157 @@ exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` 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 + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) + mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU - #undef mips64 - #undef mips64el + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el + CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 + CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - 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 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1053,11 +1032,11 @@ echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1074,7 +1053,7 @@ i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) @@ -1089,7 +1068,7 @@ fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1117,13 +1096,13 @@ exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp - exit ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1158,8 +1137,8 @@ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ @@ -1182,7 +1161,7 @@ rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) @@ -1202,10 +1181,10 @@ echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1231,11 +1210,11 @@ exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1248,6 +1227,9 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1274,9 +1256,21 @@ exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1290,7 +1284,10 @@ *:QNX:*:4*) echo i386-pc-qnx exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1335,13 +1332,13 @@ echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1359,11 +1356,11 @@ i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c < printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif Index: b/Cfg/config.sub =================================================================== --- a/Cfg/config.sub +++ b/Cfg/config.sub @@ -1,44 +1,40 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 -# Free Software Foundation, Inc. - -timestamp='2009-04-17' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# 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 -# the Free Software Foundation; either version 2 of the License, or +# Copyright 1992-2013 Free Software Foundation, Inc. + +timestamp='2013-08-10' + +# 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 +# the Free Software Foundation; either version 3 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. +# 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 Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -72,8 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -120,13 +115,18 @@ # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -149,10 +149,13 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -167,10 +170,10 @@ os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -215,6 +218,12 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -239,20 +248,27 @@ # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -270,32 +286,45 @@ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ - | nios | nios2 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | or32 \ + | open8 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -305,6 +334,21 @@ basic_machine=mt-unknown ;; + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -319,25 +363,30 @@ # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -355,28 +404,34 @@ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ - | nios-* | nios2-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ | tron-* \ - | v850-* | v850e-* | vax-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) @@ -401,7 +456,7 @@ basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -467,11 +522,24 @@ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; - cegcc) + cegcc) basic_machine=arm-unknown os=-cegcc ;; @@ -503,7 +571,7 @@ basic_machine=craynv-cray os=-unicosmp ;; - cr16) + cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; @@ -661,7 +729,6 @@ i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -719,8 +786,15 @@ basic_machine=ns32k-utek os=-sysv ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -755,10 +829,18 @@ ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i686-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -823,6 +905,12 @@ np1) basic_machine=np1-gould ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -905,9 +993,10 @@ ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -932,7 +1021,11 @@ basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1001,6 +1094,9 @@ basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -1057,20 +1153,8 @@ basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1140,6 +1224,9 @@ xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1237,9 +1324,12 @@ if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1260,22 +1350,23 @@ # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1283,7 +1374,7 @@ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1322,7 +1413,7 @@ -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1371,7 +1462,7 @@ -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1407,15 +1498,14 @@ -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; + -nacl*) + ;; -none) ;; *) @@ -1438,10 +1528,10 @@ # system, and we'll never get to this point. case $basic_machine in - score-*) + score-*) os=-elf ;; - spu-*) + spu-*) os=-elf ;; *-acorn) @@ -1453,8 +1543,23 @@ arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1474,14 +1579,11 @@ ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; - mep-*) + mep-*) os=-elf ;; mips*-cisco) @@ -1490,6 +1592,9 @@ mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; @@ -1508,7 +1613,7 @@ *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) @@ -1613,7 +1718,7 @@ -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) debian/patches/CVE-2017-8362.patch0000664000000000000000000000234413112355566013256 0ustar Index: libsndfile-1.0.25/src/flac.c =================================================================== --- libsndfile-1.0.25.orig/src/flac.c 2017-05-27 22:40:18.182686052 +0200 +++ libsndfile-1.0.25/src/flac.c 2017-05-27 22:40:18.174685574 +0200 @@ -163,6 +163,14 @@ const int32_t* const *buffer = pflac->wbuffer ; unsigned i = 0, j, offset, channels, len ; + if (psf->sf.channels != (int) frame->header.channels) + { psf_log_printf (psf, "Error: FLAC frame changed from %d to %d channels\n" + "Nothing to do but to error out.\n" , + psf->sf.channels, frame->header.channels) ; + psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ; + return 0 ; + } ; + /* ** frame->header.blocksize is variable and we're using a constant blocksize ** of FLAC__MAX_BLOCK_SIZE. @@ -429,7 +437,7 @@ { case FLAC__METADATA_TYPE_STREAMINFO : if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels) { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n" - "Nothing to be but to error out.\n" , + "Nothing to do but to error out.\n" , psf->sf.channels, metadata->data.stream_info.channels) ; psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ; return ; debian/patches/CVE-2015-7805.patch0000664000000000000000000000115412631317516013251 0ustar commit e4a75172f83894a4e821807b6d94770095ddaeff Author: Erik de Castro Lopo Date: Mon Nov 9 22:10:35 2015 +1100 diff --git a/src/common.c b/src/common.c index 8aadbab..543c2c8 100644 --- a/src/common.c +++ b/src/common.c @@ -805,7 +805,8 @@ header_read (SF_PRIVATE *psf, void *ptr, int bytes) if (psf->headindex + bytes > SIGNED_SIZEOF (psf->header)) { int most ; - most = SIGNED_SIZEOF (psf->header) - psf->headindex ; + most = SIGNED_SIZEOF (psf->header) - psf->headend ; + psf_fread (psf->header + psf->headend, 1, most, psf) ; memset ((char *) ptr + most, 0, bytes - most) ; debian/patches/01_sd2_rsrc_segfault.diff0000664000000000000000000001731312170473033015371 0ustar commit 9341e9c6e70cd3ad76c901c3cf052d4cb52fd827 Author: Erik de Castro Lopo Date: Thu Jun 27 18:04:03 2013 +1000 src/sd2.c : Fix segfault in SD2 RSRC parser. A specially crafted resource fork for an SD2 file can cause the SD2 RSRC parser to read data from outside a dynamically defined buffer. The data that is read is converted into a short or int and used during further processing. Since no write occurs, this is unlikely to be exploitable. Bug reported by The Mayhem Team from Cylab, Carnegie Mellon Univeristy. Paper is: http://users.ece.cmu.edu/~arebert/papers/mayhem-oakland-12.pdf diff --git a/src/sd2.c b/src/sd2.c index 35ce36b..6be150c 100644 --- a/src/sd2.c +++ b/src/sd2.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 2001-2011 Erik de Castro Lopo +** Copyright (C) 2001-2013 Erik de Castro Lopo ** Copyright (C) 2004 Paavo Jumppanen ** ** This program is free software; you can redistribute it and/or modify @@ -371,44 +371,61 @@ sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length)) */ static inline int -read_char (const unsigned char * data, int offset) -{ return data [offset] ; -} /* read_char */ +read_rsrc_char (const SD2_RSRC *prsrc, int offset) +{ const unsigned char * data = prsrc->rsrc_data ; + if (offset < 0 || offset >= prsrc->rsrc_len) + return 0 ; + return data [offset] ; +} /* read_rsrc_char */ static inline int -read_short (const unsigned char * data, int offset) -{ return (data [offset] << 8) + data [offset + 1] ; -} /* read_short */ +read_rsrc_short (const SD2_RSRC *prsrc, int offset) +{ const unsigned char * data = prsrc->rsrc_data ; + if (offset < 0 || offset + 1 >= prsrc->rsrc_len) + return 0 ; + return (data [offset] << 8) + data [offset + 1] ; +} /* read_rsrc_short */ static inline int -read_int (const unsigned char * data, int offset) -{ return (data [offset] << 24) + (data [offset + 1] << 16) + (data [offset + 2] << 8) + data [offset + 3] ; -} /* read_int */ +read_rsrc_int (const SD2_RSRC *prsrc, int offset) +{ const unsigned char * data = prsrc->rsrc_data ; + if (offset < 0 || offset + 3 >= prsrc->rsrc_len) + return 0 ; + return (data [offset] << 24) + (data [offset + 1] << 16) + (data [offset + 2] << 8) + data [offset + 3] ; +} /* read_rsrc_int */ static inline int -read_marker (const unsigned char * data, int offset) -{ +read_rsrc_marker (const SD2_RSRC *prsrc, int offset) +{ const unsigned char * data = prsrc->rsrc_data ; + + if (offset < 0 || offset + 3 >= prsrc->rsrc_len) + return 0 ; + if (CPU_IS_BIG_ENDIAN) return (data [offset] << 24) + (data [offset + 1] << 16) + (data [offset + 2] << 8) + data [offset + 3] ; - else if (CPU_IS_LITTLE_ENDIAN) + if (CPU_IS_LITTLE_ENDIAN) return data [offset] + (data [offset + 1] << 8) + (data [offset + 2] << 16) + (data [offset + 3] << 24) ; - else - return 0x666 ; -} /* read_marker */ + + return 0 ; +} /* read_rsrc_marker */ static void -read_str (const unsigned char * data, int offset, char * buffer, int buffer_len) -{ int k ; +read_rsrc_str (const SD2_RSRC *prsrc, int offset, char * buffer, int buffer_len) +{ const unsigned char * data = prsrc->rsrc_data ; + int k ; memset (buffer, 0, buffer_len) ; + if (offset < 0 || offset + buffer_len >= prsrc->rsrc_len) + return ; + for (k = 0 ; k < buffer_len - 1 ; k++) { if (psf_isprint (data [offset + k]) == 0) return ; buffer [k] = data [offset + k] ; } ; return ; -} /* read_str */ +} /* read_rsrc_str */ static int sd2_parse_rsrc_fork (SF_PRIVATE *psf) @@ -435,17 +452,17 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf) /* Reset the header storage because we have changed to the rsrcdes. */ psf->headindex = psf->headend = rsrc.rsrc_len ; - rsrc.data_offset = read_int (rsrc.rsrc_data, 0) ; - rsrc.map_offset = read_int (rsrc.rsrc_data, 4) ; - rsrc.data_length = read_int (rsrc.rsrc_data, 8) ; - rsrc.map_length = read_int (rsrc.rsrc_data, 12) ; + rsrc.data_offset = read_rsrc_int (&rsrc, 0) ; + rsrc.map_offset = read_rsrc_int (&rsrc, 4) ; + rsrc.data_length = read_rsrc_int (&rsrc, 8) ; + rsrc.map_length = read_rsrc_int (&rsrc, 12) ; if (rsrc.data_offset == 0x51607 && rsrc.map_offset == 0x20000) { psf_log_printf (psf, "Trying offset of 0x52 bytes.\n") ; - rsrc.data_offset = read_int (rsrc.rsrc_data, 0x52 + 0) + 0x52 ; - rsrc.map_offset = read_int (rsrc.rsrc_data, 0x52 + 4) + 0x52 ; - rsrc.data_length = read_int (rsrc.rsrc_data, 0x52 + 8) ; - rsrc.map_length = read_int (rsrc.rsrc_data, 0x52 + 12) ; + rsrc.data_offset = read_rsrc_int (&rsrc, 0x52 + 0) + 0x52 ; + rsrc.map_offset = read_rsrc_int (&rsrc, 0x52 + 4) + 0x52 ; + rsrc.data_length = read_rsrc_int (&rsrc, 0x52 + 8) ; + rsrc.map_length = read_rsrc_int (&rsrc, 0x52 + 12) ; } ; psf_log_printf (psf, " data offset : 0x%04X\n map offset : 0x%04X\n" @@ -488,7 +505,7 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf) goto parse_rsrc_fork_cleanup ; } ; - rsrc.string_offset = rsrc.map_offset + read_short (rsrc.rsrc_data, rsrc.map_offset + 26) ; + rsrc.string_offset = rsrc.map_offset + read_rsrc_short (&rsrc, rsrc.map_offset + 26) ; if (rsrc.string_offset > rsrc.rsrc_len) { psf_log_printf (psf, "Bad string offset (%d).\n", rsrc.string_offset) ; error = SFE_SD2_BAD_RSRC ; @@ -497,7 +514,7 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf) rsrc.type_offset = rsrc.map_offset + 30 ; - rsrc.type_count = read_short (rsrc.rsrc_data, rsrc.map_offset + 28) + 1 ; + rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ; if (rsrc.type_count < 1) { psf_log_printf (psf, "Bad type count.\n") ; error = SFE_SD2_BAD_RSRC ; @@ -513,11 +530,11 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf) rsrc.str_index = -1 ; for (k = 0 ; k < rsrc.type_count ; k ++) - { marker = read_marker (rsrc.rsrc_data, rsrc.type_offset + k * 8) ; + { marker = read_rsrc_marker (&rsrc, rsrc.type_offset + k * 8) ; if (marker == STR_MARKER) { rsrc.str_index = k ; - rsrc.str_count = read_short (rsrc.rsrc_data, rsrc.type_offset + k * 8 + 4) + 1 ; + rsrc.str_count = read_rsrc_short (&rsrc, rsrc.type_offset + k * 8 + 4) + 1 ; error = parse_str_rsrc (psf, &rsrc) ; goto parse_rsrc_fork_cleanup ; } ; @@ -549,26 +566,26 @@ parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc) for (k = 0 ; data_offset + data_len < rsrc->rsrc_len ; k++) { int slen ; - slen = read_char (rsrc->rsrc_data, str_offset) ; - read_str (rsrc->rsrc_data, str_offset + 1, name, SF_MIN (SIGNED_SIZEOF (name), slen + 1)) ; + slen = read_rsrc_char (rsrc, str_offset) ; + read_rsrc_str (rsrc, str_offset + 1, name, SF_MIN (SIGNED_SIZEOF (name), slen + 1)) ; str_offset += slen + 1 ; - rsrc_id = read_short (rsrc->rsrc_data, rsrc->item_offset + k * 12) ; + rsrc_id = read_rsrc_short (rsrc, rsrc->item_offset + k * 12) ; - data_offset = rsrc->data_offset + read_int (rsrc->rsrc_data, rsrc->item_offset + k * 12 + 4) ; + data_offset = rsrc->data_offset + read_rsrc_int (rsrc, rsrc->item_offset + k * 12 + 4) ; if (data_offset < 0 || data_offset > rsrc->rsrc_len) { psf_log_printf (psf, "Exiting parser on data offset of %d.\n", data_offset) ; break ; } ; - data_len = read_int (rsrc->rsrc_data, data_offset) ; + data_len = read_rsrc_int (rsrc, data_offset) ; if (data_len < 0 || data_len > rsrc->rsrc_len) { psf_log_printf (psf, "Exiting parser on data length of %d.\n", data_len) ; break ; } ; - slen = read_char (rsrc->rsrc_data, data_offset + 4) ; - read_str (rsrc->rsrc_data, data_offset + 5, value, SF_MIN (SIGNED_SIZEOF (value), slen + 1)) ; + slen = read_rsrc_char (rsrc, data_offset + 4) ; + read_rsrc_str (rsrc, data_offset + 5, value, SF_MIN (SIGNED_SIZEOF (value), slen + 1)) ; psf_log_printf (psf, " 0x%04x %4d %4d %3d '%s'\n", data_offset, rsrc_id, data_len, slen, value) ; debian/patches/CVE-2017-8361_8363_8365.patch0000664000000000000000000000447413112340676014427 0ustar Index: libsndfile-1.0.25/src/common.h =================================================================== --- libsndfile-1.0.25.orig/src/common.h 2017-05-27 20:13:07.532269186 +0200 +++ libsndfile-1.0.25/src/common.h 2017-05-27 20:13:07.528268948 +0200 @@ -623,6 +623,7 @@ SFE_FLAC_INIT_DECODER, SFE_FLAC_LOST_SYNC, SFE_FLAC_BAD_SAMPLE_RATE, + SFE_FLAC_CHANNEL_COUNT_CHANGED, SFE_FLAC_UNKOWN_ERROR, SFE_WVE_NOT_WVE, Index: libsndfile-1.0.25/src/flac.c =================================================================== --- libsndfile-1.0.25.orig/src/flac.c 2017-05-27 20:13:07.532269186 +0200 +++ libsndfile-1.0.25/src/flac.c 2017-05-27 20:13:07.528268948 +0200 @@ -427,6 +427,19 @@ switch (metadata->type) { case FLAC__METADATA_TYPE_STREAMINFO : + if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels) + { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n" + "Nothing to be but to error out.\n" , + psf->sf.channels, metadata->data.stream_info.channels) ; + psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ; + return ; + } ; + + if (psf->sf.channels > 0 && psf->sf.samplerate != (int) metadata->data.stream_info.sample_rate) + { psf_log_printf (psf, "Warning: FLAC stream changed sample rates from %d to %d.\n" + "Carrying on as if nothing happened.", + psf->sf.samplerate, metadata->data.stream_info.sample_rate) ; + } ; psf->sf.channels = metadata->data.stream_info.channels ; psf->sf.samplerate = metadata->data.stream_info.sample_rate ; psf->sf.frames = metadata->data.stream_info.total_samples ; Index: libsndfile-1.0.25/src/sndfile.c =================================================================== --- libsndfile-1.0.25.orig/src/sndfile.c 2017-05-27 20:13:07.532269186 +0200 +++ libsndfile-1.0.25/src/sndfile.c 2017-05-27 20:13:07.528268948 +0200 @@ -242,6 +242,7 @@ { SFE_FLAC_INIT_DECODER , "Error : problem while initialization of the flac decoder." }, { SFE_FLAC_LOST_SYNC , "Error : flac decoder lost sync." }, { SFE_FLAC_BAD_SAMPLE_RATE, "Error : flac does not support this sample rate." }, + { SFE_FLAC_CHANNEL_COUNT_CHANGED, "Error : flac channel changed mid stream." }, { SFE_FLAC_UNKOWN_ERROR , "Error : unknown error in flac decoder." }, { SFE_WVE_NOT_WVE , "Error : not a WVE file." }, debian/patches/CVE-2014-9496.patch0000664000000000000000000000243712631317506013264 0ustar From dbe14f00030af5d3577f4cabbf9861db59e9c378 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Thu, 25 Dec 2014 19:23:12 +1100 Subject: [PATCH] src/sd2.c : Fix two potential buffer read overflows. Closes: https://github.com/erikd/libsndfile/issues/93 --- src/sd2.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) Index: libsndfile-1.0.25/src/sd2.c =================================================================== --- libsndfile-1.0.25.orig/src/sd2.c +++ libsndfile-1.0.25/src/sd2.c @@ -513,6 +513,11 @@ rsrc.type_offset = rsrc.map_offset + 30 ; + if (rsrc.map_offset + 28 > rsrc.rsrc_len) + { psf_log_printf (psf, "Bad map offset.\n") ; + goto parse_rsrc_fork_cleanup ; + } ; + rsrc.type_count = read_rsrc_short (&rsrc, rsrc.map_offset + 28) + 1 ; if (rsrc.type_count < 1) { psf_log_printf (psf, "Bad type count.\n") ; @@ -529,7 +534,12 @@ rsrc.str_index = -1 ; for (k = 0 ; k < rsrc.type_count ; k ++) - { marker = read_rsrc_marker (&rsrc, rsrc.type_offset + k * 8) ; + { if (rsrc.type_offset + k * 8 > rsrc.rsrc_len) + { psf_log_printf (psf, "Bad rsrc marker.\n") ; + goto parse_rsrc_fork_cleanup ; + } ; + + marker = read_rsrc_marker (&rsrc, rsrc.type_offset + k * 8) ; if (marker == STR_MARKER) { rsrc.str_index = k ; debian/copyright0000664000000000000000000001106112170473033011122 0ustar This package was debianized by H. S. Teoh on Mon, 28 Aug 2000 12:41:14 -0400. It was downloaded from: http://www.mega-nerd.com/libsndfile/ Upstream Author: Erik de Castro Lopo The upstream source tarball has a library source directory (src), a test suite directory (tests), a directory of utility programs (programs) and a directory of example code (examples). The majority of the library src/ directory is copyright as: Copyright (c) 1999-2009 Erik de Castro Lopo Copyright (c) 2002 Xiph.org Foundation Copyright (C) 2003 Ross Bencina Copyright (C) 2004 Paavo Jumppanen Copyright (C) 2004 Tobias Gehrig Copyright (C) 2004-2005 David Viens Copyright (C) 2006 Paul Davis Copyright (C) 2007 John ffitch Copyright (C) 2007 Reuben Thomas Copyright (c) 2007 LGPL licenced. The complete text of the LGPL license can be found in /usr/share/common-licenses/LGPL-2.1+ on Debian systems. The directory src/GSM610/ is copyright as: Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, Technische Universitaet Berlin Any use of this software is permitted provided that this notice is not removed and that neither the authors nor the Technische Universitaet Berlin are deemed to have made any representations as to the suitability of this software for any purpose nor are held responsible for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. As a matter of courtesy, the authors request to be informed about uses this software has found, about bugs in this software, and about any improvements that may be of general interest. Berlin, 28.11.1994 Jutta Degener Carsten Bormann The directory src/G72x/ is copyright as: This source code is a product of Sun Microsystems, Inc. and is provided for unrestricted use. Users may copy or modify this source code without charge. SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. Sun source code is provided with no support and without any obligation on the part of Sun Microsystems, Inc. to assist in its use, correction, modification or enhancement. SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE OR ANY PART THEREOF. In no event will Sun Microsystems, Inc. be liable for any lost revenue or profits or other special, indirect and consequential damages, even if Sun has been advised of the possibility of such damages. Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, California 94043 The example and utility programs are copyright as: Copyright (C) 2001-2009 Erik de Castro Lopo Copyright (C) 2007 Jonatan Liljedahl Copyright (C) 2008 George Blood Audio All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. debian/watch0000664000000000000000000000012412170473033010216 0ustar version=3 http://www.mega-nerd.com/libsndfile/files/ libsndfile-([\d\.]+)\.tar\.gz debian/libsndfile1-dev.docs0000664000000000000000000000005412170473033013011 0ustar NEWS README AUTHORS doc/new_file_type.HOWTO debian/libsndfile1-dev.install0000664000000000000000000000016512170473033013532 0ustar usr/include/* usr/lib/*/lib*.a usr/lib/*/lib*.so usr/lib/*/pkgconfig/sndfile.pc usr/share/doc/libsndfile1-dev/html/* debian/libsndfile1-dev.doc-base0000664000000000000000000000047012170473033013540 0ustar Document: libsndfile Title: Debian libsndfile Manual Author: Erik de Castro Lopo Abstract: Programming manual and examples for the libsndfile library. Section: Programming Format: HTML Index: /usr/share/doc/libsndfile1-dev/html/index.html Files: /usr/share/doc/libsndfile1-dev/html/*.html debian/rules0000775000000000000000000000522112253266660010260 0ustar #!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # http://wiki.debian.org/Hardening#Using_Hardening_Options CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) CFLAGS := $(shell dpkg-buildflags --get CFLAGS) CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif config.status: configure dh_testdir dh_autoreconf ./configure $(shell dpkg-buildflags --export=configure) \ --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \ --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info build: patch build-stamp build-stamp: config.status dh_testdir $(MAKE) ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) # Failure in test suite must cause a build failure. $(MAKE) check endif touch build-stamp clean: unpatch dh_testdir dh_testroot rm -f build-stamp [ ! -f Makefile ] || $(MAKE) distclean dh_autoreconf_clean dh_clean -a install: build dh_testdir dh_testroot dh_prep -a dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp # Purge *.la files. See: http://wiki.debian.org/ReleaseGoals/LAFileRemoval rm -f debian/tmp/usr/lib/*/*.la binary-indep: build install build-arch: build build-indep: build binary-arch: build install dh_testdir dh_testroot dh_install -a --sourcedir=debian/tmp --list-missing # This line can be removed when these man pages get pushed upstream. dh_installman -psndfile-programs debian/sndfile-interleave.1 dh_link -psndfile-programs usr/share/man/man1/sndfile-interleave.1 usr/share/man/man1/sndfile-deinterleave.1 dh_installdocs -a dh_installexamples -a dh_installchangelogs -a ChangeLog dh_strip -plibsndfile1 --dbg-package=libsndfile1-dbg dh_strip -psndfile-programs --dbg-package=sndfile-programs-dbg dh_compress -a dh_fixperms -a dh_makeshlibs -plibsndfile1 dh_installdeb -a dh_shlibdeps -plibsndfile1 dh_shlibdeps -psndfile-programs -ldebian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install patch unpatch