Commit Graph

3090 Commits

Author SHA1 Message Date
David Seifert
bc11600986
configure.ac: fix broken --enable-ossfuzzers option
* Passing `--disable-ossfuzzers` would actually enable fuzzers.
2022-09-13 10:30:28 +02:00
Jörn Heusipp
3bd5048f8c Define SF_COUNT_MAX as INT64_MAX.
INT64_MAX instead of 0x7FFFFFFFFFFFFFFFLL avoids type discrepancy between int64_t and LL (long long) suffix when int64_t is not long long.
2022-09-12 18:54:29 +02:00
Jörn Heusipp
bd951f9a47 Make sndfile.h independent of build system variables
Fixes <https://github.com/libsndfile/libsndfile/issues/868>.
2022-09-12 10:39:37 +02:00
IOhannes m zmölnig
cefd7b59df tests: Use fuzzy comparison in test-suite
Using exact comparison ("a == b") when comparing expected with computed
test data fails the test-suite on many architectures (including, but not
limited to armhf and arm64).

Instead, use epsilon(for now, FLT_EPSILON and DBL_EPSILON) to compare
floating point numbers for equality.


Closes: https://github.com/libsndfile/libsndfile/issues/866

Signed-off-by: IOhannes m zmölnig <zmoelnig@iem.at>
2022-09-09 13:04:00 +05:00
Benjamin Moody
36216ba105 flac: fix reading a large number of samples at once
When reading a FLAC file, the internal function flac_read_loop is used
to read a block of samples and copy them to the application-provided
output buffer.  The 'len' argument to flac_read_loop is the total
number of samples to read (i.e., duration times number of channels.)

Various fields in the FLAC_PRIVATE structure, as well as local
variables in various internal functions, are 'unsigned', which means
that trying to read into a buffer larger than UINT_MAX will cause
problems.  To avoid these problems, each function that calls
flac_read_loop breaks up the operation into buffers of at most
0x1000000 (2^24) total samples.

However, flac_read_loop will also fail (due to the condition at line
224) if the requested 'len' is not a multiple of the number of
channels.  Consequently, if an application tried to read:

 - more than 5592405 frames at once from a three-channel FLAC file
 - more than 3355443 frames at once from a five-channel FLAC file
 - more than 2796202 frames at once from a six-channel FLAC file
 - more than 2396745 frames at once from a seven-channel FLAC file

then sf_read_* or sf_readf_* would incorrectly fail and return zero.

As a simple fix, change the internal size limit from 0x1000000 to
0x690000 (2^16 * 3 * 5 * 7).  This is still quite arbitrary, but is
guaranteed to be divisible by the number of channels (which must be
between 1 and 8); it also ought to be large enough to avoid any
performance overhead, and small enough to be easy to test.
2022-08-06 11:24:33 +05:00
Justace Clutter
53e7dee234
Remove samplerate < SF_MAX_SAMPLERATE requirement (#851)
Related to #850.

Co-authored-by: evpobr <evpobr@gmail.com>
2022-07-11 13:32:40 +05:00
Shaohua Li
a4f1387ab8 Update g72x.c
Fixing signed integer overflow as reported in https://github.com/libsndfile/libsndfile/issues/757 . A similar fix was applied before https://github.com/libsndfile/libsndfile/pull/818
2022-05-31 13:10:26 +05:00
evpobr
a17e32fda6 Use Visual Studio 2022 for GitHub Actions 2022-04-18 13:51:26 +05:00
Michael Cho
e4fdaeefdd configure.ac: substitute EXTERNAL_MPEG_LIBS in sndfile.pc 2022-04-18 13:36:44 +05:00
Stefan Westerfeld
a67c601b0c Support skipping large wav chunks on stdin.
Some wav files can have rather large chunks with chunk types that are
not supported by libsndfile at all. For those, header_seek will just
skip the whole chunk.

This commit makes skipping the chunk work even if the input is stdin
(which doesn't support psf_fseek), by reading over the header using
psf_fread in that case.
2022-04-12 14:01:51 +05:00
Arthur Taylor
718e305dc1 ogg: Correct Opus-assumption of gp rate in _seek_page_search() 2022-04-11 12:16:03 -07:00
Arthur Taylor
7c2053ac96 ogg: convert helper macros to inline functions, documentation updates 2022-04-11 12:16:03 -07:00
Arthur Taylor
bbe95850d9 sndfile.h: Fix accidental command enum reuse for GET_OGG_STERAM_SERIALNO 2022-04-11 12:16:03 -07:00
Arthur Taylor
5c79b98890 ogg_opus: Rename page seeking funcitons 2022-04-11 12:16:03 -07:00
Arthur Taylor
79e654fe6b ogg_opus: Rearange seek pre-roll logic 2022-04-11 12:16:03 -07:00
Arthur Taylor
fdeb8438ad ogg_opus: Fix preskip of granulepos offset files 2022-04-11 12:16:03 -07:00
Arthur Taylor
08c34a81a5 ogg_opus: Cleanups and robustness fixes to seek_page_search 2022-04-11 12:16:03 -07:00
Arthur Taylor
63338de798 ogg_opus: Fix double-counting of len on seek_null_read 2022-04-11 12:16:03 -07:00
Arthur Taylor
66bbb78801 ogg_opus: Grow pre-roll based on experimentation, update comments 2022-04-11 12:16:03 -07:00
Arthur Taylor
70175e9cc1 ogg: Use macros for undocumented ogg_stream state queries. 2022-04-11 12:16:03 -07:00
Arthur Taylor
b56aba5633 ogg: Correct various psf_log_printf() argument length issues. 2022-04-11 12:16:03 -07:00
Arthur Taylor
3aab1c5617 ogg: Add command SFC_GET_OGG_STREAM_SERIALNO
Add command SFC_GET_OGG_STREAM_SERIALNO returning the current stream
serialno. Useful for debugging.
2022-04-11 12:16:03 -07:00
Arthur Taylor
3baa16571f ogg: Fix for issue-794, buffering of searched page is wrong.
The function ogg_stream_seek_page_search() is a reimplementation of
op_pcm_seek_page from libopusfile. This original function contained a
bug a bug caused by a non-braced if body followed by two statements that
should be conditional. Being non-braced, only the first statement was
conditional.

The bug caused previous-page buffering always to be on. Previous page
buffering is an efficiency gain for seeking to positions that are part
of a continued packet. Erroneously always turning it on prevents the
loading of the correct page at the end of the search in some conditions.

This manifested as seek-search working for some positions and not
others, depending on the order of found pages near the final target.
2022-04-11 12:16:03 -07:00
evpobr
83e583dd2c Fix typo 2022-04-06 10:18:19 +05:00
evpobr
d6f83cd4fe gsm610: Fix signed integer overflow
Related to libsndfile#785

Co-authored-by: evpobr <evpobr@gmail.com>
2022-04-06 10:05:41 +05:00
evpobr
fc298c9d93 Fix build on UWP platform, closes #824 2022-04-03 12:13:29 +05:00
evpobr
269ae40a3b Fix CMake build from Autotools tarball, closes #816 2022-04-03 12:05:00 +05:00
evpobr
eff5f0a640 cmake: fix LAME dependency search 2022-04-03 11:41:07 +05:00
David Seifert
33e765ccba
Remove obsolete SF_PLATFORM_S64() macro 2022-04-02 20:53:09 +02:00
David Seifert
ea3ac90e98
Release 1.1.0 2022-03-27 13:48:57 +02:00
evpobr
89e7c02464 Prepare to release 2022-03-27 15:31:49 +05:00
David Seifert
ce57da8fd4
Only add -Wno-format-truncation when using GCC
* Clang produces warnings such as
  warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
2022-03-27 13:20:49 +02:00
evpobr
4b01368fd8 Update CHANGELOG.md 2022-03-19 09:32:03 +05:00
evpobr
77acc6d362 cmake: Add config-file package MPEG dependency 2021-12-16 12:57:05 +05:00
evpobr
59f1622c42 cmake: Export targets from the build tree 2021-12-16 12:57:05 +05:00
AdamKorcz
f44c8dbe1d
Fuzzing: Add CIFuzz (#796) 2021-12-14 08:32:18 +05:00
Felix Lange
ca2008903f
sndfile-convert: fix typo in error message (#793)
Co-authored-by: evpobr <evpobr@gmail.com>
2021-11-24 09:52:36 +05:00
evpobr
47383a6cc2 Update CHANGELOG.md 2021-11-24 09:43:36 +05:00
evpobr
759592e4df Add Vcpkg binary caching
Speed up GitHub Actions CI using Vcpkg binary caching feature.

Dependencies are built once and on next run restored from GitHub
packages.
2021-11-21 19:19:26 +05:00
evpobr
0c10913b92 Add support for Vcpkg manifest mode
https://vcpkg.readthedocs.io/en/latest/users/manifests/
2021-11-21 14:49:44 +05:00
evpobr
739bc8cdac Fix unintialized variable in psf_binheader_readf()
Thanks to @shao-hua-li
2021-11-21 12:58:44 +05:00
evpobr
7e2db6e8ef Create SECURITY.md 2021-11-18 09:57:37 +05:00
evpobr
c7b69d7589 Update CHANGELOG.md
Commit 404bf9a also fixes
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25624.
2021-11-09 21:01:06 +05:00
evpobr
b1307c7755 ci: Remove yasm-tools for x64-windows workaround 2021-11-09 14:52:19 +05:00
evpobr
404bf9af79 Fix integer overflow in psf_log_printf()
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28441

Credit to OSS-Fuzz.
2021-11-09 14:28:10 +05:00
David Seifert
f1495b4bcc
Release 1.1.0beta2
Fixes #784
2021-10-24 14:53:12 +02:00
David Seifert
1c407fe823
libtool: don't build static archives by default 2021-10-24 14:53:11 +02:00
David Seifert
4b64fd767a
programs/sndfile-deinterleave.c: fix broken calloc call
Fixes #783
2021-10-24 14:26:31 +02:00
David Seifert
aaac071f60
update CHANGELOG.md for MPEG-III-in-wav 2021-10-24 13:37:08 +02:00
Arthur Taylor
e09e5dd043 mpeg: Move dataoffset check from codec to format init 2021-10-22 23:57:30 -07:00