Commit Graph

2828 Commits

Author SHA1 Message Date
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 ff26310437.

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
evpobr
affb1d088d programs/sndfile-salvage.c: Fix wrong filename in error message
Closes: #290
2017-06-14 19:55:37 +10:00
David Seifert
c368828476 Suppress -Wimplicit-fallthrough warnings
* GCC 7 recognises only a limited number of suppressors:
  https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
2017-06-06 08:19:21 +10:00
David Seifert
7b099b2370 Remove echo-install-dirs script and inline echo statements
* Using AX_RECURSIVE_EVAL to determine the full absolute path
  and printing it inline in the configure script is less
  brittle than calling another script from configure.
2017-06-06 08:19:21 +10:00
David Seifert
7264aefd09 Use AM_PATH_PYTHON to handle python
* AM_PATH_PYTHON is more versatile and allows the
  user to specify the python interpreter to use.
2017-06-06 08:19:21 +10:00
David Seifert
d607b78f02 Produce bzip tarballs
* bzip tarballs are significantly smaller than gzip
  tarballs and preferred by distributions nowadays.
2017-06-06 08:19:21 +10:00
David Seifert
28f7f80a7e Use -C instead of cd'ing into dir for $(MAKE) 2017-06-06 06:41:55 +10:00
David Seifert
2e24132b84 Do not add Makefile.am in M4/ dir 2017-06-06 06:41:55 +10:00
David Seifert
8321896954 Fix GCC 7 warnings
* sfendian.h:28:24: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
2017-06-06 06:41:55 +10:00
David Seifert
ccbba1957d Replace some MN_* macros by AX_* macros 2017-06-06 06:41:55 +10:00
David Seifert
a274030cc0 Cleanup configure.ac to use modern Autoconf idioms 2017-06-06 06:41:55 +10:00
Erik de Castro Lopo
7dadd9ea66 doc/index.html: Drop 24 bit from IRCAM
This is a documentation bug fix. libsndfile never supported 25 bit IRCAM
and IRCAM never specified 24 bit support.

Closes: https://github.com/erikd/libsndfile/issues/283
2017-06-05 17:52:36 +10:00
Erik de Castro Lopo
d5b785afdd sndfile-play.c: Fix scaling of float samples with ALSA.
Seems ALSA wants float samples in the [-1.0, 1.0] range.

Closes: https://github.com/erikd/libsndfile/issues/275
2017-05-31 20:02:04 +10:00
evpobr
3d8399dfde Fix broken ABI
Unfortunately ABI was broken when symbols files were removed
in favour of new visibility control of exported functions.

Visibility control with -fvisibility works fine, but symbol
scripts had another feature - versioned symbols. And we lost it.

Since we can not make our symbols to be versioned  with the new
approach, it's decided to return everything back.

* CMake: Restore symbol files generation
* CMake: Python is required to build shared libraries
* Autotools: Restore symbol files generation

Closes: https://github.com/erikd/libsndfile/issues/268
2017-05-26 06:16:42 +10:00
evpobr
3fca78d4b3 src/common.c: Fix typo
Closes: https://github.com/erikd/libsndfile/issues/272
2017-05-25 07:58:48 +10:00
Erik de Castro Lopo
f833c53cb5 src/aiff.c: Fix a buffer read overflow
Secunia Advisory SA76717.

Found by: Laurent Delosieres, Secunia Research at Flexera Software
2017-05-23 20:15:27 +10:00
Peter Meerwald-Stadler
66aa47ffee .gitignore: Suppress libsndfile.def 2017-05-22 18:10:52 +10:00
Robert Mancoast
21e1d00073 rework gitignore to cover msvc builds 2017-05-21 14:52:25 +10:00
Erik de Castro Lopo
993fc6cecc src/sd2.c: Fix a psf_binheader_writef usage bug
Unfortunately this bug cannot be found by the compiler and the tests
didn't find it either. It was found during work to improve the type
safety of calls to psf_binheader_writef.
2017-05-20 22:32:48 +10:00
Matthieu Poullet
e6d68161d1 make_sine.c: small code cleanup.
make_sine.c: fix typo in output message.
make_sine.c: use return instead of exit in main.
make_sine.c: unify error messages.
make_sine.c: return error code if malloc fails.
make_sine.c: free memory and close file handle in error case.
2017-05-19 21:42:59 +10:00
Erik de Castro Lopo
9923b2a0a2 src/aiff.c: Remove INST chunk writing
This code had egregious errors in the way things were being passed
to psf_binheader_writef and neither the compiler nor the tests
caught it. It was however found when adding safety macros to enforce
correct type being passed to psf_binheader_writef.
2017-05-16 21:03:22 +10:00
evpobr
0cdd232b9f regtest/database.c: Fix compilation with MSVC
getcwd function requires direct.h header.
2017-05-08 21:42:03 +10:00
Erik de Castro Lopo
9f5b4e5d8d FAQ: Update MP3 support answer 2017-05-07 10:28:22 +10:00
Erik de Castro Lopo
7c476eec91 src/Makefile.am: Add EXTERNAL_XIPH_CFLAGS for libcommon 2017-05-07 10:28:22 +10:00
evpobr
44269a0892 Tests: Fix win32_ordinal_test 2017-05-06 01:55:14 +10:00
Erik de Castro Lopo
b506de463d Fix MSAN errors
Fix multiple errors uncovered by Clang's Memory Sanitizer.

Closes: https://github.com/erikd/libsndfile/issues/248
2017-05-04 18:42:24 +10:00