2703 Commits

Author SHA1 Message Date
Arthur Taylor
33f0d0658a wav.c: Specify widths of header members for NMS_VBXADPCM 2018-03-08 18:13:03 +11:00
Arthur Taylor
6239927a11 Support NMS_ADPCM subformats with major format WAVE 2018-03-08 18:13:03 +11:00
Arthur Taylor
89da46f168 wav: Add support for WAVE_FORMAT_NMS_VBXADPCM
Found a set of NMS ADPCM wav files to verify.
2018-03-08 18:13:03 +11:00
Arthur Taylor
64e5a3f182 Add NMS ADPCM codec implementation and support
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-02-03 19:44:33 +11:00
evpobr
871ecd7f70 src/sndfile.c: Set SFC_GET_LIB_VERSION return result to 0 on error
If data == NULL string is not copied but command returns SFE_BAD_COMMAND_PARAM (31). It can be misunsderstood as string length.
2018-02-03 16:23:23 +11:00
Jonathan Wakely
2241075e47 sndfile-convert: Check if conversion failed due to no. of channels
This fixes the problem noted in #43 where attempting to convert a stereo
WAV to SDS gives a misleading error about the codec, when the real problem
is that the output format only supports mono not stereo.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-02-03 16:12:42 +11:00
Jonathan Wakely
40d3e412e0 Fix spelling 2018-02-03 13:17:04 +11:00
Jan Starý
2acea2723a sndfile-play: Remove BEOS support
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-02-03 13:10:10 +11:00
Jan Starý
e6b473ed8e drop MacOSX from sndfile-play
We don't play on MacOSX >= 10.8 (the code for the new API is not written),
and support for MacOSX older than that was removed some time ago.
So drop the last remnants; we just don't play on MacOSX.
2018-02-03 12:54:50 +11:00
Erik de Castro Lopo
adc0d425f9 configure.ac: Report whether building Octave interface 2018-01-07 12:14:46 +11:00
Jan Starý
38f1214117 unbreak sed(1) in pre-commit
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-01-07 11:53:48 +11:00
Jan Starý
d1c591aea2 configure.ac: Fix --enable-octave doc string
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-01-07 11:50:52 +11:00
Erik de Castro Lopo
6b0df6060c sndfile.c: Return the length of log output
There were two handers for SFC_GET_LOG_INFO and one incorrectly was
not returning the length of log string.

Closes: https://github.com/erikd/libsndfile/issues/345
2017-12-13 18:54:31 +11:00
David Honour
d252bec831 Simplify psf_fseek logic
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-11-26 16:26:40 +11:00
David Honour
24075a649a Add test to reproduce seeking with fileoffset bugs
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-11-26 16:24:30 +11:00
evpobr
826d5296da Add AppVeyor CI script 2017-10-31 19:30:54 +11:00
Erik de Castro Lopo
5d4d1feca0 Remove redundant libsndfile.def.in 2017-10-31 18:42:40 +11:00
Erik de Castro Lopo
af9d26411b Scripts/build-test-tarball.mk.in: Updates 2017-10-28 16:17:55 +11:00
Erik de Castro Lopo
dfe09db021 Makefile.am: Resurect test-tarball target 2017-10-28 12:55:50 +11:00
Erik de Castro Lopo
ac5b66a447 configure.ac: Add -mstackrealign to CFLAGS for mingw* 2017-10-27 19:35:21 +11:00
Erik de Castro Lopo
9b4fdaccc1 tests/header_test.tpl: Fix a memory leak
Found using AddressSanitizer.
2017-10-26 19:21:06 +11:00
evpobr
fa92cc4b88 src/sfconfig.h: Fix CPU architecture detection under Windows 2017-10-21 18:35:45 +11:00
evpobr
d356f3f292 src/sfendian.h: Detect and use MSVC byte swap intrinsics 2017-10-21 18:34:48 +11:00
Erik de Castro Lopo
e02f64cd98 Fix travis OSX build 2017-10-14 21:24:29 +11:00
Erik de Castro Lopo
203096325d programs/sndfile-convert.c: Add -float64 conversion 2017-10-14 20:54:56 +11:00
David Seifert
b17f14d613 Make git checkout buildable out-of-tree
Currently, libsndfile requires in-tree bootstrapping and creation
of the tarball. For Gentoo, some users might want to build the
latest git checkout. This commit makes out-of-tree building of all
the necessary dependencies possible.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-10-08 18:23:58 +11:00
Derek Gasaway
2c2d9a8eb2 Remove unused internal headers from examples. 2017-10-02 10:26:32 +11:00
Erik de Castro Lopo
cc5e831a75 A couple of minor cstyle fixes 2017-10-01 16:33:41 +11:00
Erik de Castro Lopo
c00b785fbd Scripts/cstyle.py: Add some new rules 2017-10-01 16:33:29 +11:00
Ghabry
3f8d728f01 configure.ac: Fix configure for vitasdk
Closes: https://github.com/erikd/libsndfile/issues/310
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-09-30 20:28:14 +10:00
Ghabry
45fb22f52e Replace custom definitions of int16_t etc with <stdint.h> versions
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-09-30 20:26:01 +10:00
Ghabry
df6c86efaa src/wavlik.h: Fix function protype/definition mismatch
For functions `wavlike_read_bext_chunk` and `wavlike_read_cart_chunk`.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-09-30 20:24:41 +10:00
Fabian Greffrath
85c877d507 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>
2017-09-30 20:16:11 +10:00
David Honour
ef888c6fae FLAC: Fix inconsistent indentation
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-09-28 10:42:36 +10:00
David Honour
71444146ae Fix typo in macro name 2017-09-26 19:47:49 +10:00
Johannes Kroll
b9e544328e FLAC: fix clipping of negative values
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-09-26 19:43:45 +10:00
David Seifert
e6c42ff027 Make build system completely non-recursive 2017-09-26 19:35:56 +10:00
Erik de Castro Lopo
beee21e5c2 Revert "tests/Makefile.am: Switch away from GNU make rules"
This reverts commit ff263104376de6ad18938e0c13ca910d47c51042.

The GNU make rules actually work. The old style suffix rules do not.
2017-08-10 20:22:18 +10:00
Henner Zeller
f96e5a2047 Add test for flac regression update-header-before-write
Explicitly writing the header with SFC_UPDATE_HEADER_NOW before
the first sf_write() was making sf_write() calls fail. This is a
test to verify that the fix works.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-08-10 20:09:55 +10:00
Henner Zeller
a81308ee40 Make sure FLAC__stream_encoder_init_stream() is only called once.
The FLAC__stream_encoder_init_stream() function complains if it is
called multiple times. If we happen to have flushed the header
manually before with sf_command(snd, SFC_UPDATE_HEADER_NOW, ...),
then all subsequent sf_write...() functions fail otherwise because
they attempt to write the header again.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-08-10 20:09:05 +10:00
Erik de Castro Lopo
2658c5f9b0 sfendian.h: Simplify CPP logic 2017-08-10 07:04:11 +10:00
Erik de Castro Lopo
af4890ca63 Fix x86/x86_64 CPU detection regression
Regression introduced in commit 8321896.
Reported by Anonymous Maarten.

Closes: https://github.com/erikd/libsndfile/pull/306
2017-08-10 07:04:11 +10:00
Erik de Castro Lopo
fa1d42fddd src/sndfile.c: Remove un-needed memset before free
Closes: https://github.com/erikd/libsndfile/issues/302
2017-07-29 12:08:10 +10:00
Erik de Castro Lopo
e6a1749832 sndfile-deinterleave.c: Check for errors in path handling
Closes: https://github.com/erikd/libsndfile/issues/301
2017-07-29 12:08:10 +10:00
Erik de Castro Lopo
5efe93de20 programs/common.c: Fix compiler warning 2017-07-29 12:08:10 +10:00
Erik de Castro Lopo
aa104ad7e3 Update src/binheader_writef_check.py
Update this validator to detect problems with the new format specifiers
when calling `psf_binheader_writef`.
2017-07-18 06:07:05 +10:00
Erik de Castro Lopo
7bc10c8630 src/*.c: New format specifiers for psf_binheader_writef
There was a long standing problem where the compiler was not able to
check format speficiers for `psf_binheader_writef`. This is a standard
problem with using non-standard format specifiers with stdargs.

This solution wraps all non-format parameters pass to that functions
with a macro which performs an explicit type cast. The second step is
to have a Python program make sure these macro wrappers match the
format specifiers.

Closes: https://github.com/erikd/libsndfile/issues/241
2017-07-18 06:07:05 +10:00
Erik de Castro Lopo
c144d78fd4 Fix sf_count_t detection on android
Closes: https://github.com/erikd/libsndfile/issues/295
2017-07-03 06:22:01 +10:00
David Seifert
baa3b79ce2 Update Travis dependencies
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-07-02 15:40:01 +10:00
Jörn Heusipp
cf7a8182c2 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
2017-06-15 19:19:32 +10:00