Index: head/audio/libsndfile/Makefile =================================================================== --- head/audio/libsndfile/Makefile (revision 495439) +++ head/audio/libsndfile/Makefile (revision 495440) @@ -1,49 +1,49 @@ # Created by: ijliao # $FreeBSD$ PORTNAME= libsndfile PORTVERSION= 1.0.28 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= audio MASTER_SITES= http://www.mega-nerd.com/libsndfile/files/ MAINTAINER= multimedia@FreeBSD.org COMMENT= Reading and writing files containing sampled sound (like WAV or AIFF) LICENSE= LGPL21+ LICENSE_FILE= ${WRKSRC}/COPYING USES= cpe gmake libtool localbase pkgconfig CPE_VENDOR= ${CPE_PRODUCT}_project GNU_CONFIGURE= yes CONFIGURE_ARGS= --disable-gcc-pipe \ --disable-sqlite \ --disable-alsa \ --disable-octave \ --with-pkgconfigdir=${PREFIX}/libdata/pkgconfig USE_LDCONFIG= yes TEST_TARGET= check INSTALL_TARGET= install-strip OPTIONS_DEFINE= CPU_CLIP EXTERNAL DOCS OPTIONS_DEFAULT= EXTERNAL CPU_CLIP_DESC= Allow machine-dependent clipping EXTERNAL_DESC= Enable FLAC and Ogg Vorbis support CPU_CLIP_VARS= MANUAL_PACKAGE_BUILD="WITH_CPU_CLIP may customize the package for the build machine" CPU_CLIP_CONFIGURE_OFF= --disable-cpu-clip EXTERNAL_LIB_DEPENDS= libFLAC.so:audio/flac \ libogg.so:audio/libogg \ libvorbis.so:audio/libvorbis EXTERNAL_CONFIGURE_OFF= --disable-external-libs post-patch: @${REINPLACE_CMD} -e '/^SUBDIRS =/s/ doc / /g' ${WRKSRC}/Makefile.in post-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} @${TAR} -C ${WRKSRC}/doc --exclude "*Makefile*" --exclude "*.in" \ -cf - . | ${TAR} -C ${STAGEDIR}${DOCSDIR} --unlink -xf - .include Index: head/audio/libsndfile/files/patch-CVE-2017-17456_2017-17457_2018-19661_2018-19662 =================================================================== --- head/audio/libsndfile/files/patch-CVE-2017-17456_2017-17457_2018-19661_2018-19662 (nonexistent) +++ head/audio/libsndfile/files/patch-CVE-2017-17456_2017-17457_2018-19661_2018-19662 (revision 495440) @@ -0,0 +1,90 @@ +From: Hugo Lefeuvre +Date: Mon, 24 Dec 2018 06:43:48 +0100 +Subject: a/ulaw: fix multiple buffer overflows (#432) + +i2ulaw_array() and i2alaw_array() fail to handle ptr [count] = INT_MIN +properly, leading to buffer underflow. INT_MIN is a special value +since - INT_MIN cannot be represented as int. + +In this case round - INT_MIN to INT_MAX and proceed as usual. + +f2ulaw_array() and f2alaw_array() fail to handle ptr [count] = NaN +properly, leading to null pointer dereference. + +In this case, arbitrarily set the buffer value to 0. + +This commit fixes #429 (CVE-2018-19661 and CVE-2018-19662) and +fixes #344 (CVE-2017-17456 and CVE-2017-17457). +--- + src/alaw.c | 9 +++++++-- + src/ulaw.c | 9 +++++++-- + 2 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/src/alaw.c b/src/alaw.c +index 063fd1a..4220224 100644 +--- src/alaw.c ++++ src/alaw.c +@@ -19,6 +19,7 @@ + #include "sfconfig.h" + + #include ++#include + + #include "sndfile.h" + #include "common.h" +@@ -326,7 +327,9 @@ s2alaw_array (const short *ptr, int count, unsigned char *buffer) + static inline void + i2alaw_array (const int *ptr, int count, unsigned char *buffer) + { while (--count >= 0) +- { if (ptr [count] >= 0) ++ { if (ptr [count] == INT_MIN) ++ buffer [count] = alaw_encode [INT_MAX >> (16 + 4)] ; ++ else if (ptr [count] >= 0) + buffer [count] = alaw_encode [ptr [count] >> (16 + 4)] ; + else + buffer [count] = 0x7F & alaw_encode [- ptr [count] >> (16 + 4)] ; +@@ -346,7 +349,9 @@ f2alaw_array (const float *ptr, int count, unsigned char *buffer, float normfact + static inline void + d2alaw_array (const double *ptr, int count, unsigned char *buffer, double normfact) + { while (--count >= 0) +- { if (ptr [count] >= 0) ++ { if (!isfinite (ptr [count])) ++ buffer [count] = 0 ; ++ else if (ptr [count] >= 0) + buffer [count] = alaw_encode [lrint (normfact * ptr [count])] ; + else + buffer [count] = 0x7F & alaw_encode [- lrint (normfact * ptr [count])] ; +diff --git a/src/ulaw.c b/src/ulaw.c +index e50b4cb..b6070ad 100644 +--- src/ulaw.c ++++ src/ulaw.c +@@ -19,6 +19,7 @@ + #include "sfconfig.h" + + #include ++#include + + #include "sndfile.h" + #include "common.h" +@@ -827,7 +828,9 @@ s2ulaw_array (const short *ptr, int count, unsigned char *buffer) + static inline void + i2ulaw_array (const int *ptr, int count, unsigned char *buffer) + { while (--count >= 0) +- { if (ptr [count] >= 0) ++ { if (ptr [count] == INT_MIN) ++ buffer [count] = ulaw_encode [INT_MAX >> (16 + 2)] ; ++ else if (ptr [count] >= 0) + buffer [count] = ulaw_encode [ptr [count] >> (16 + 2)] ; + else + buffer [count] = 0x7F & ulaw_encode [-ptr [count] >> (16 + 2)] ; +@@ -847,7 +850,9 @@ f2ulaw_array (const float *ptr, int count, unsigned char *buffer, float normfact + static inline void + d2ulaw_array (const double *ptr, int count, unsigned char *buffer, double normfact) + { while (--count >= 0) +- { if (ptr [count] >= 0) ++ { if (!isfinite (ptr [count])) ++ buffer [count] = 0 ; ++ else if (ptr [count] >= 0) + buffer [count] = ulaw_encode [lrint (normfact * ptr [count])] ; + else + buffer [count] = 0x7F & ulaw_encode [- lrint (normfact * ptr [count])] ; Property changes on: head/audio/libsndfile/files/patch-CVE-2017-17456_2017-17457_2018-19661_2018-19662 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/audio/libsndfile/files/patch-CVE-2018-19758 =================================================================== --- head/audio/libsndfile/files/patch-CVE-2018-19758 (nonexistent) +++ head/audio/libsndfile/files/patch-CVE-2018-19758 (revision 495440) @@ -0,0 +1,31 @@ +From: Erik de Castro Lopo +Date: Tue, 1 Jan 2019 20:11:46 +1100 +Subject: src/wav.c: Fix heap read overflow + +This is CVE-2018-19758. + +Closes: https://github.com/erikd/libsndfile/issues/435 +--- + src/wav.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/wav.c b/src/wav.c +index 4b943dc..59015a1 100644 +--- src/wav.c ++++ src/wav.c +@@ -1,5 +1,5 @@ + /* +-** Copyright (C) 1999-2016 Erik de Castro Lopo ++** Copyright (C) 1999-2019 Erik de Castro Lopo + ** Copyright (C) 2004-2005 David Viens + ** + ** This program is free software; you can redistribute it and/or modify +@@ -1094,6 +1094,8 @@ wav_write_header (SF_PRIVATE *psf, int calc_length) + psf_binheader_writef (psf, "44", 0, 0) ; /* SMTPE format */ + psf_binheader_writef (psf, "44", psf->instrument->loop_count, 0) ; + ++ /* Loop count is signed 16 bit number so we limit it range to something sensible. */ ++ psf->instrument->loop_count &= 0x7fff ; + for (tmp = 0 ; tmp < psf->instrument->loop_count ; tmp++) + { int type ; + Property changes on: head/audio/libsndfile/files/patch-CVE-2018-19758 ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/audio/libsndfile/files/patch-Check-MAX_CHANNELS-in-sndfile-deinterleave =================================================================== --- head/audio/libsndfile/files/patch-Check-MAX_CHANNELS-in-sndfile-deinterleave (nonexistent) +++ head/audio/libsndfile/files/patch-Check-MAX_CHANNELS-in-sndfile-deinterleave (revision 495440) @@ -0,0 +1,30 @@ +From: "Brett T. Warden" +Date: Tue, 28 Aug 2018 12:01:17 -0700 +Subject: Check MAX_CHANNELS in sndfile-deinterleave + +Allocated buffer has space for only 16 channels. Verify that input file +meets this limit. + +Fixes #397 +--- + programs/sndfile-deinterleave.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/programs/sndfile-deinterleave.c b/programs/sndfile-deinterleave.c +index e27593e..cb497e1 100644 +--- programs/sndfile-deinterleave.c ++++ programs/sndfile-deinterleave.c +@@ -89,6 +89,13 @@ main (int argc, char **argv) + exit (1) ; + } ; + ++ if (sfinfo.channels > MAX_CHANNELS) ++ { printf ("\nError : Input file '%s' has too many (%d) channels. Limit is %d.\n", ++ argv [1], sfinfo.channels, MAX_CHANNELS) ; ++ exit (1) ; ++ } ; ++ ++ + state.channels = sfinfo.channels ; + sfinfo.channels = 1 ; + Property changes on: head/audio/libsndfile/files/patch-Check-MAX_CHANNELS-in-sndfile-deinterleave ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/audio/libsndfile/files/patch-rf64_arm =================================================================== --- head/audio/libsndfile/files/patch-rf64_arm (nonexistent) +++ head/audio/libsndfile/files/patch-rf64_arm (revision 495440) @@ -0,0 +1,49 @@ +From: Erik de Castro Lopez +Date: Tue, 20 Jun 2017 00:00:00 +0200 +Subject: fix RF64 on armel/armhf archs + +Origin: upstream +Applied-Upstream: 9d470ee5577d3ccedb1c28c7e0a7295ba17feaf5 +Last-Update: 2017-06-20 +--- + src/rf64.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/rf64.c b/src/rf64.c +index c373bb0..60a3309 100644 +--- src/rf64.c ++++ src/rf64.c +@@ -339,6 +339,12 @@ rf64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock) + } ; + break ; + ++ case JUNK_MARKER : ++ case PAD_MARKER : ++ psf_log_printf (psf, "%M : %d\n", marker, chunk_size) ; ++ psf_binheader_readf (psf, "j", chunk_size) ; ++ break ; ++ + default : + if (chunk_size >= 0xffff0000) + { psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %u. Exiting parser.\n", marker, psf_ftell (psf) - 8, chunk_size) ; +@@ -659,7 +665,7 @@ rf64_write_header (SF_PRIVATE *psf, int calc_length) + + if (wpriv->rf64_downgrade && psf->filelength < RIFF_DOWNGRADE_BYTES) + { psf_binheader_writef (psf, "etm8m", RIFF_MARKER, (psf->filelength < 8) ? 8 : psf->filelength - 8, WAVE_MARKER) ; +- psf_binheader_writef (psf, "m4884", JUNK_MARKER, 20, 0, 0, 0, 0) ; ++ psf_binheader_writef (psf, "m4z", JUNK_MARKER, 24, 24) ; + add_fact_chunk = 1 ; + } + else +@@ -735,9 +741,10 @@ rf64_write_header (SF_PRIVATE *psf, int calc_length) + + #endif + ++ /* Padding may be needed if string data sizes change. */ + pad_size = psf->dataoffset - 16 - psf->header.indx ; + if (pad_size >= 0) +- psf_binheader_writef (psf, "m4z", PAD_MARKER, pad_size, make_size_t (pad_size)) ; ++ psf_binheader_writef (psf, "m4z", PAD_MARKER, (unsigned int) pad_size, make_size_t (pad_size)) ; + + if (wpriv->rf64_downgrade && (psf->filelength < RIFF_DOWNGRADE_BYTES)) + psf_binheader_writef (psf, "tm8", data_MARKER, psf->datalength) ; Property changes on: head/audio/libsndfile/files/patch-rf64_arm ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/audio/libsndfile/files/patch-typos =================================================================== --- head/audio/libsndfile/files/patch-typos (nonexistent) +++ head/audio/libsndfile/files/patch-typos (revision 495440) @@ -0,0 +1,67 @@ +From: IOhannes m zmoelnig +Date: Wed, 5 Oct 2016 00:00:00 +0200 +Subject: fixed spelling errors + +Forwarded: yes +Last-Update: 2016-10-05 + +discovered by lintian +--- + doc/bugs.html | 2 +- + programs/sndfile-convert.c | 2 +- + src/ogg.c | 2 +- + src/wavlike.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/doc/bugs.html b/doc/bugs.html +index 3a441fe..addedb8 100644 +--- doc/bugs.html ++++ doc/bugs.html +@@ -31,7 +31,7 @@ +
    +
  • Compilation problems on new platforms. +
  • Errors being detected during the `make check' process. +-
  • Segmentation faults occuring inside libsndfile. ++
  • Segmentation faults occurring inside libsndfile. +
  • libsndfile hanging when opening a file. +
  • Supported sound file types being incorrectly read or written. +
  • Omissions, errors or spelling mistakes in the documentation. +diff --git a/programs/sndfile-convert.c b/programs/sndfile-convert.c +index dff7f79..896838f 100644 +--- programs/sndfile-convert.c ++++ programs/sndfile-convert.c +@@ -317,7 +317,7 @@ main (int argc, char * argv []) + if ((sfinfo.format & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 && sfinfo.samplerate != 8000) + { printf ( + "WARNING: GSM 6.10 data format only supports 8kHz sample rate. The converted\n" +- "ouput file will contain the input data converted to the GSM 6.10 data format\n" ++ "output file will contain the input data converted to the GSM 6.10 data format\n" + "but not re-sampled.\n" + ) ; + } ; +diff --git a/src/ogg.c b/src/ogg.c +index 0856f77..e01ebe1 100644 +--- src/ogg.c ++++ src/ogg.c +@@ -193,7 +193,7 @@ ogg_stream_classify (SF_PRIVATE *psf, OGG_PRIVATE* odata) + break ; + } ; + +- psf_log_printf (psf, "This Ogg bitstream contains some uknown data type.\n") ; ++ psf_log_printf (psf, "This Ogg bitstream contains some unknown data type.\n") ; + return SFE_UNIMPLEMENTED ; + } /* ogg_stream_classify */ + +diff --git a/src/wavlike.c b/src/wavlike.c +index 86ebf01..c053da3 100644 +--- src/wavlike.c ++++ src/wavlike.c +@@ -161,7 +161,7 @@ wavlike_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize) + { psf_log_printf (psf, " Bit Width : 24\n") ; + + psf_log_printf (psf, "\n" +- " Ambiguous information in 'fmt ' chunk. Possibile file types:\n" ++ " Ambiguous information in 'fmt ' chunk. Possible file types:\n" + " 0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n" + " 1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n" + " 2) 24 bit file with incorrect Block Align value.\n" Property changes on: head/audio/libsndfile/files/patch-typos ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property