libsndfile: update to 1.0.30
This commit is contained in:
parent
3a7766655d
commit
f9cb9a1712
|
@ -1,85 +0,0 @@
|
|||
commit cf7a8182c2642c50f1cf90dddea9ce96a8bad2e8
|
||||
Author: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
|
||||
Date: Wed Jun 14 12:25:40 2017 +0200
|
||||
|
||||
src/common.c: Fix heap buffer overflows when writing strings in binheader
|
||||
|
||||
Fixes the following problems:
|
||||
1. Case 's' only enlarges the buffer by 16 bytes instead of size bytes.
|
||||
2. psf_binheader_writef() enlarges the header buffer (if needed) prior to the
|
||||
big switch statement by an amount (16 bytes) which is enough for all cases
|
||||
where only a single value gets added. Cases 's', 'S', 'p' however
|
||||
additionally write an arbitrary length block of data and again enlarge the
|
||||
buffer to the required amount. However, the required space calculation does
|
||||
not take into account the size of the length field which gets output before
|
||||
the data.
|
||||
3. Buffer size requirement calculation in case 'S' does not account for the
|
||||
padding byte ("size += (size & 1) ;" happens after the calculation which
|
||||
uses "size").
|
||||
4. Case 'S' can overrun the header buffer by 1 byte when no padding is
|
||||
involved
|
||||
("memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size + 1) ;" while
|
||||
the buffer is only guaranteed to have "size" space available).
|
||||
5. "psf->header.ptr [psf->header.indx] = 0 ;" in case 'S' always writes 1 byte
|
||||
beyond the space which is guaranteed to be allocated in the header buffer.
|
||||
6. Case 's' can overrun the provided source string by 1 byte if padding is
|
||||
involved ("memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ;"
|
||||
where "size" is "strlen (strptr) + 1" (which includes the 0 terminator,
|
||||
plus optionally another 1 which is padding and not guaranteed to be
|
||||
readable via the source string pointer).
|
||||
|
||||
Closes: https://github.com/erikd/libsndfile/issues/292
|
||||
|
||||
diff --git src/common.c src/common.c
|
||||
index 1a6204ca..6b2a2ee9 100644
|
||||
--- src/common.c
|
||||
+++ src/common.c
|
||||
@@ -681,16 +681,16 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
||||
/* Write a C string (guaranteed to have a zero terminator). */
|
||||
strptr = va_arg (argptr, char *) ;
|
||||
size = strlen (strptr) + 1 ;
|
||||
- size += (size & 1) ;
|
||||
|
||||
- if (psf->header.indx + (sf_count_t) size >= psf->header.len && psf_bump_header_allocation (psf, 16))
|
||||
+ if (psf->header.indx + 4 + (sf_count_t) size + (sf_count_t) (size & 1) > psf->header.len && psf_bump_header_allocation (psf, 4 + size + (size & 1)))
|
||||
return count ;
|
||||
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
- header_put_be_int (psf, size) ;
|
||||
+ header_put_be_int (psf, size + (size & 1)) ;
|
||||
else
|
||||
- header_put_le_int (psf, size) ;
|
||||
+ header_put_le_int (psf, size + (size & 1)) ;
|
||||
memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ;
|
||||
+ size += (size & 1) ;
|
||||
psf->header.indx += size ;
|
||||
psf->header.ptr [psf->header.indx - 1] = 0 ;
|
||||
count += 4 + size ;
|
||||
@@ -703,16 +703,15 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
||||
*/
|
||||
strptr = va_arg (argptr, char *) ;
|
||||
size = strlen (strptr) ;
|
||||
- if (psf->header.indx + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, size))
|
||||
+ if (psf->header.indx + 4 + (sf_count_t) size + (sf_count_t) (size & 1) > psf->header.len && psf_bump_header_allocation (psf, 4 + size + (size & 1)))
|
||||
return count ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
header_put_be_int (psf, size) ;
|
||||
else
|
||||
header_put_le_int (psf, size) ;
|
||||
- memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size + 1) ;
|
||||
+ memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size + (size & 1)) ;
|
||||
size += (size & 1) ;
|
||||
psf->header.indx += size ;
|
||||
- psf->header.ptr [psf->header.indx] = 0 ;
|
||||
count += 4 + size ;
|
||||
break ;
|
||||
|
||||
@@ -724,7 +723,7 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
||||
size = (size & 1) ? size : size + 1 ;
|
||||
size = (size > 254) ? 254 : size ;
|
||||
|
||||
- if (psf->header.indx + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, size))
|
||||
+ if (psf->header.indx + 1 + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, 1 + size))
|
||||
return count ;
|
||||
|
||||
header_put_byte (psf, size) ;
|
|
@ -1,108 +0,0 @@
|
|||
commit 2d54514a4f6437b67829717c05472d2e3300a258
|
||||
Author: Fabian Greffrath <fabian@greffrath.com>
|
||||
Date: Wed Sep 27 14:46:17 2017 +0200
|
||||
|
||||
sfe_copy_data_fp: check value of "max" variable for being normal
|
||||
|
||||
and check elements of the data[] array for being finite.
|
||||
|
||||
Both checks use functions provided by the <math.h> header as declared
|
||||
by the C99 standard.
|
||||
|
||||
Fixes #317
|
||||
CVE-2017-14245
|
||||
CVE-2017-14246
|
||||
|
||||
diff --git programs/common.c programs/common.c
|
||||
index a21e62ca..a249a585 100644
|
||||
--- programs/common.c
|
||||
+++ programs/common.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
+#include <math.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
@@ -45,7 +46,7 @@
|
||||
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
-void
|
||||
+int
|
||||
sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize)
|
||||
{ static double data [BUFFER_LEN], max ;
|
||||
sf_count_t frames, readcount, k ;
|
||||
@@ -54,6 +55,8 @@ sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize
|
||||
readcount = frames ;
|
||||
|
||||
sf_command (infile, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
|
||||
+ if (!isnormal (max)) /* neither zero, subnormal, infinite, nor NaN */
|
||||
+ return 1 ;
|
||||
|
||||
if (!normalize && max < 1.0)
|
||||
{ while (readcount > 0)
|
||||
@@ -67,12 +70,16 @@ sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_double (infile, data, frames) ;
|
||||
for (k = 0 ; k < readcount * channels ; k++)
|
||||
- data [k] /= max ;
|
||||
+ { data [k] /= max ;
|
||||
+
|
||||
+ if (!isfinite (data [k])) /* infinite or NaN */
|
||||
+ return 1;
|
||||
+ }
|
||||
sf_writef_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
- return ;
|
||||
+ return 0 ;
|
||||
} /* sfe_copy_data_fp */
|
||||
|
||||
void
|
||||
@@ -252,7 +259,12 @@ sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * in
|
||||
|
||||
/* If the input file is not the same as the output file, copy the data. */
|
||||
if ((infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT))
|
||||
- sfe_copy_data_fp (outfile, infile, sfinfo.channels, SF_FALSE) ;
|
||||
+ { if (sfe_copy_data_fp (outfile, infile, sfinfo.channels, SF_FALSE) != 0)
|
||||
+ { printf ("Error : Not able to decode input file '%s'\n", filenames [0]) ;
|
||||
+ error_code = 1 ;
|
||||
+ goto cleanup_exit ;
|
||||
+ } ;
|
||||
+ }
|
||||
else
|
||||
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
|
||||
} ;
|
||||
diff --git programs/common.h programs/common.h
|
||||
index eda2d7d7..986277ee 100644
|
||||
--- programs/common.h
|
||||
+++ programs/common.h
|
||||
@@ -62,7 +62,7 @@ typedef SF_BROADCAST_INFO_VAR (2048) SF_BROADCAST_INFO_2K ;
|
||||
|
||||
void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info) ;
|
||||
|
||||
-void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize) ;
|
||||
+int sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize) ;
|
||||
|
||||
void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
||||
|
||||
diff --git programs/sndfile-convert.c programs/sndfile-convert.c
|
||||
index dff7f793..e6de5935 100644
|
||||
--- programs/sndfile-convert.c
|
||||
+++ programs/sndfile-convert.c
|
||||
@@ -335,7 +335,11 @@ main (int argc, char * argv [])
|
||||
|| (outfileminor == SF_FORMAT_DOUBLE) || (outfileminor == SF_FORMAT_FLOAT)
|
||||
|| (infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT)
|
||||
|| (infileminor == SF_FORMAT_VORBIS) || (outfileminor == SF_FORMAT_VORBIS))
|
||||
- sfe_copy_data_fp (outfile, infile, sfinfo.channels, normalize) ;
|
||||
+ { if (sfe_copy_data_fp (outfile, infile, sfinfo.channels, normalize) != 0)
|
||||
+ { printf ("Error : Not able to decode input file %s.\n", infilename) ;
|
||||
+ return 1 ;
|
||||
+ } ;
|
||||
+ }
|
||||
else
|
||||
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
commit 85c877d5072866aadbe8ed0c3e0590fbb5e16788
|
||||
Author: Fabian Greffrath <fabian@greffrath.com>
|
||||
Date: Thu Sep 28 12:15:04 2017 +0200
|
||||
|
||||
double64_init: Check psf->sf.channels against upper bound
|
||||
|
||||
This prevents division by zero later in the code.
|
||||
|
||||
While the trivial case to catch this (i.e. sf.channels < 1) has already
|
||||
been covered, a crafted file may report a number of channels that is
|
||||
so high (i.e. > INT_MAX/sizeof(double)) that it "somehow" gets
|
||||
miscalculated to zero (if this makes sense) in the determination of the
|
||||
blockwidth. Since we only support a limited number of channels anyway,
|
||||
make sure to check here as well.
|
||||
|
||||
CVE-2017-14634
|
||||
|
||||
Closes: https://github.com/erikd/libsndfile/issues/318
|
||||
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
|
||||
diff --git src/double64.c src/double64.c
|
||||
index b318ea86..78dfef7f 100644
|
||||
--- src/double64.c
|
||||
+++ src/double64.c
|
||||
@@ -91,7 +91,7 @@ int
|
||||
double64_init (SF_PRIVATE *psf)
|
||||
{ static int double64_caps ;
|
||||
|
||||
- if (psf->sf.channels < 1)
|
||||
+ if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS)
|
||||
{ psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
|
@ -1,88 +0,0 @@
|
|||
commit 8ddc442d539ca775d80cdbc7af17a718634a743f
|
||||
Author: Hugo Lefeuvre <hle@owl.eu.com>
|
||||
Date: Mon Dec 24 06:43:48 2018 +0100
|
||||
|
||||
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).
|
||||
|
||||
diff --git src/alaw.c src/alaw.c
|
||||
index 063fd1a2..4220224c 100644
|
||||
--- src/alaw.c
|
||||
+++ src/alaw.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <math.h>
|
||||
+#include <limits.h>
|
||||
|
||||
#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 src/ulaw.c src/ulaw.c
|
||||
index e50b4cb5..b6070ade 100644
|
||||
--- src/ulaw.c
|
||||
+++ src/ulaw.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <math.h>
|
||||
+#include <limits.h>
|
||||
|
||||
#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])] ;
|
|
@ -1,23 +0,0 @@
|
|||
commit f833c53cb596e9e1792949f762e0b33661822748
|
||||
Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
Date: Tue May 23 20:15:24 2017 +1000
|
||||
|
||||
src/aiff.c: Fix a buffer read overflow
|
||||
|
||||
Secunia Advisory SA76717.
|
||||
|
||||
Found by: Laurent Delosieres, Secunia Research at Flexera Software
|
||||
|
||||
diff --git src/aiff.c src/aiff.c
|
||||
index 5b5f9f53..45864b76 100644
|
||||
--- src/aiff.c
|
||||
+++ src/aiff.c
|
||||
@@ -1759,7 +1759,7 @@ aiff_read_chanmap (SF_PRIVATE * psf, unsigned dword)
|
||||
psf_binheader_readf (psf, "j", dword - bytesread) ;
|
||||
|
||||
if (map_info->channel_map != NULL)
|
||||
- { size_t chanmap_size = psf->sf.channels * sizeof (psf->channel_map [0]) ;
|
||||
+ { size_t chanmap_size = SF_MIN (psf->sf.channels, layout_tag & 0xffff) * sizeof (psf->channel_map [0]) ;
|
||||
|
||||
free (psf->channel_map) ;
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
commit ef1dbb2df1c0e741486646de40bd638a9c4cd808
|
||||
Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
Date: Fri Apr 14 15:19:16 2017 +1000
|
||||
|
||||
src/flac.c: Fix a buffer read overflow
|
||||
|
||||
A file (generated by a fuzzer) which increased the number of channels
|
||||
from one frame to the next could cause a read beyond the end of the
|
||||
buffer provided by libFLAC. Only option is to abort the read.
|
||||
|
||||
Closes: https://github.com/erikd/libsndfile/issues/231
|
||||
|
||||
diff --git src/flac.c src/flac.c
|
||||
index 5a4f8c21..e4f9aaa0 100644
|
||||
--- src/flac.c
|
||||
+++ src/flac.c
|
||||
@@ -169,6 +169,14 @@ flac_buffer_copy (SF_PRIVATE *psf)
|
||||
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.
|
||||
@@ -202,7 +210,6 @@ flac_buffer_copy (SF_PRIVATE *psf)
|
||||
return 0 ;
|
||||
} ;
|
||||
|
||||
-
|
||||
len = SF_MIN (pflac->len, frame->header.blocksize) ;
|
||||
|
||||
if (pflac->remain % channels != 0)
|
|
@ -1,67 +0,0 @@
|
|||
commit cd7da8dbf6ee4310d21d9e44b385d6797160d9e8
|
||||
Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
Date: Wed Apr 12 20:19:34 2017 +1000
|
||||
|
||||
src/flac.c: Fix another memory leak
|
||||
|
||||
When the FLAC decoder was passed a malformed file, the associated
|
||||
`FLAC__StreamDecoder` object was not getting released.
|
||||
|
||||
Closes: https://github.com/erikd/libsndfile/issues/233
|
||||
|
||||
diff --git src/flac.c src/flac.c
|
||||
index 986a7b8f..5a4f8c21 100644
|
||||
--- src/flac.c
|
||||
+++ src/flac.c
|
||||
@@ -841,7 +841,9 @@ flac_read_header (SF_PRIVATE *psf)
|
||||
|
||||
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) ;
|
||||
|
||||
commit 5206a9b65e61598fde44d276c81b0585bc428562
|
||||
Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
Date: Wed Apr 12 19:10:40 2017 +1000
|
||||
|
||||
src/flac.c: Fix a memory leak
|
||||
|
||||
The pflac->rbuffer pointer array was being allocated in two
|
||||
places, but only one of them (the one that was kept) was checking
|
||||
to ensure the pointers were NULL before allocation.
|
||||
|
||||
Leak was found by fuzzing the sndfile-resample binary compiled
|
||||
with ASAN.
|
||||
|
||||
diff --git src/flac.c src/flac.c
|
||||
index 40629c7d..84de0e26 100644
|
||||
--- src/flac.c
|
||||
+++ src/flac.c
|
||||
@@ -430,8 +430,7 @@ sf_flac_meta_get_vorbiscomments (SF_PRIVATE *psf, const FLAC__StreamMetadata *me
|
||||
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 ;
|
||||
- FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ;
|
||||
- int bitwidth = 0, i ;
|
||||
+ int bitwidth = 0 ;
|
||||
|
||||
switch (metadata->type)
|
||||
{ case FLAC__METADATA_TYPE_STREAMINFO :
|
||||
@@ -468,12 +467,6 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_
|
||||
|
||||
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 :
|
|
@ -1,60 +0,0 @@
|
|||
commit fd0484aba8e51d16af1e3a880f9b8b857b385eb3
|
||||
Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
Date: Wed Apr 12 19:45:30 2017 +1000
|
||||
|
||||
FLAC: Fix a buffer read overrun
|
||||
|
||||
Buffer read overrun occurs when reading a FLAC file that switches
|
||||
from 2 channels to one channel mid-stream. Only option is to
|
||||
abort the read.
|
||||
|
||||
Closes: https://github.com/erikd/libsndfile/issues/230
|
||||
|
||||
diff --git src/common.h src/common.h
|
||||
index 0bd810c3..e2669b6a 100644
|
||||
--- src/common.h
|
||||
+++ src/common.h
|
||||
@@ -725,6 +725,7 @@ enum
|
||||
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,
|
||||
diff --git src/flac.c src/flac.c
|
||||
index 84de0e26..986a7b8f 100644
|
||||
--- src/flac.c
|
||||
+++ src/flac.c
|
||||
@@ -434,6 +434,19 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_
|
||||
|
||||
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 ;
|
||||
diff --git src/sndfile.c src/sndfile.c
|
||||
index 41875610..e2a87be8 100644
|
||||
--- src/sndfile.c
|
||||
+++ src/sndfile.c
|
||||
@@ -245,6 +245,7 @@ ErrorStruct SndfileErrors [] =
|
||||
{ SFE_FLAC_INIT_DECODER , "Error : problem with 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." },
|
|
@ -1,29 +0,0 @@
|
|||
commit aaea680337267bfb6d2544da878890ee7f1c5077
|
||||
Author: Brett T. Warden <brett.t.warden@intel.com>
|
||||
Date: Tue Aug 28 12:01:17 2018 -0700
|
||||
|
||||
Check MAX_CHANNELS in sndfile-deinterleave
|
||||
|
||||
Allocated buffer has space for only 16 channels. Verify that input file
|
||||
meets this limit.
|
||||
|
||||
Fixes #397
|
||||
|
||||
diff --git programs/sndfile-deinterleave.c programs/sndfile-deinterleave.c
|
||||
index 53660310..225b4d54 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 ;
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
commit 42132c543358cee9f7c3e9e9b15bb6c1063a608e
|
||||
Author: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
Date: Tue Jan 1 20:11:46 2019 +1100
|
||||
|
||||
src/wav.c: Fix heap read overflow
|
||||
|
||||
This is CVE-2018-19758.
|
||||
|
||||
Closes: https://github.com/erikd/libsndfile/issues/435
|
||||
|
||||
diff --git src/wav.c src/wav.c
|
||||
index 9d71aadb..5c825f2a 100644
|
||||
--- src/wav.c
|
||||
+++ src/wav.c
|
||||
@@ -1146,6 +1146,8 @@ wav_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
psf_binheader_writef (psf, "44", BHW4 (0), BHW4 (0)) ; /* SMTPE format */
|
||||
psf_binheader_writef (psf, "44", BHW4 (psf->instrument->loop_count), BHW4 (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 ;
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
# Template file for 'libsndfile'
|
||||
pkgname=libsndfile
|
||||
version=1.0.28
|
||||
revision=3
|
||||
version=1.0.30
|
||||
revision=1
|
||||
build_style=gnu-configure
|
||||
hostmakedepends="pkg-config python"
|
||||
makedepends="alsa-lib-devel libvorbis-devel libflac-devel sqlite-devel"
|
||||
makedepends="alsa-lib-devel libvorbis-devel libflac-devel sqlite-devel opus-devel"
|
||||
short_desc="C library for reading and writing files containing sampled sound"
|
||||
maintainer="Orphaned <orphan@voidlinux.org>"
|
||||
license="LGPL-2.1-or-later"
|
||||
homepage="http://www.mega-nerd.com/libsndfile"
|
||||
distfiles="http://www.mega-nerd.com/${pkgname}/files/${pkgname}-${version}.tar.gz"
|
||||
checksum=1ff33929f042fa333aed1e8923aa628c3ee9e1eb85512686c55092d1e5a9dfa9
|
||||
distfiles="https://github.com/erikd/${pkgname}/releases/download/v${version}/${pkgname}-${version}.tar.bz2"
|
||||
checksum=ec898634766595438142c76cf3bdd46b77305d4a295dd16b29d024122d7a4b3f
|
||||
|
||||
libsndfile-progs_package() {
|
||||
short_desc+=" - bundled cmdline apps"
|
||||
|
|
Loading…
Reference in New Issue