Commit Graph

3968 Commits

Author SHA1 Message Date
Martijn van Beurden 38b7fec143 Change analyse function to support >4Gbit frames
Theoretically, when a rice parameter of 0, 24-bit samples, fixed
predictor with order 0, no rice escaping and a blocksize of 65536
is chosen, a subframe could be up to 2^24*65536 = 1 terabyte in
size. While this obviously should never happen, the analyse
function should be able to debug such a case.
2021-03-15 13:46:20 +11:00
NotTsunami 5f5035d209 flac: Work around gcc bug to prevent false unset MD5 signature warning
A bug beginning in gcc version 9.2 causes strings to get incorrectly
stripped when passed directly to memcmp with a zero first byte (1).
This bug causes flac -t to fail on any .flac file with a md5 checksum
beginning in 00. To work around this bug, the FLAC__byte type is used
for an empty md5 sum to prevent a string from being stripped, which
is backwards compatible and avoids compile-time checks. This was
initially reported back in March 2020, but has seen more light since
Ubuntu 19.10 and up ship with gcc 9.2 as the default compiler. A
patch has been merged into the master gcc branch (2), but has not
been included in any versions as of this commit date.

The initial reporter provided a patch in their bug report (3), which
is included in this PR with authorship attributed to the reporter.

(1) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189
(2) https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=d5803b9876b3d11c93d1a10fabb3fbb1c4a14bd6
(3) https://sourceforge.net/p/flac/bugs/478/

Closes #192.
2021-03-15 13:46:20 +11:00
Neelkamal Semwal d7b33142ec libFLAC/stream_decoder.c: Fix divide by zero error in FLAC__stream_decoder_seek_absolute 2021-03-15 13:46:20 +11:00
Robert Kausch 159cd6c41a libFLAC/stream_decoder.c: Use current position as bound when seeking 2021-03-15 13:46:20 +11:00
Tim Gates bfd4f13f3e
docs: fix simple typo, opertator -> operator
There is a small typo in oss-fuzz/fuzzing/datasource/datasource.hpp.

Should read `operator` rather than `opertator`.

Signed-off-by: Ralph Giles <giles@thaumas.net>
2020-12-17 11:05:31 -08:00
evpobr ce6dd6b573 CMake polishing
* Improve CPU features detection

  CMAKE_SYSTEM_PROCESSOR is pretty useless (e.g. when compiling with
  MSVC ARM64 toolchain and Ninja still returns system processor).

* Don't build src/utils targets by default

  Fix compilation for UWP platform.

* Add more Visual studio Git ignore patterns
* Autogenerate Doxygen docs
2020-05-14 13:56:01 +10:00
Ulrik Mikaelsson 37e675b777 Simplified logic of parsing sizes of rice-partitions
> if the partition order is zero, n = frame's blocksize - predictor order
> else if this is not the first partition of the subframe,
>   n = (frame's blocksize / (2^partition order))
> else n = (frame's blocksize / (2^partition order)) - predictor order

if the partition order is zero, then partition_number can only be zero
if the partition order is zero, then
  (frame's blocksize / (2^partition order))
  is (frame's blocksize / 1) == frame's blocksize
2020-05-03 17:16:19 +10:00
Thomas BERNARD 4fbb6d4f2e fix build under Mac OS X with PowerPC CPU
revert 44036c9a9b because auxv.h is only
available under Linux and FreeBSD.
2020-05-03 17:14:33 +10:00
evpobr e0b62a61a7 Bunch of CMake fixes
* Add more Git ignore patterns
* Fix Ogg dependency handling (closes #203)
* Remove unneeded compiler flag (closes #204)
* Fix Visual Studio DLL build error error C2491:
  'flac_internal_rename_utf8': definition of dllimport function not
  allowed (closes #205)
* Add alias targets
* Reduce number of CMake files
* Improve CMake intrinsics detection
2020-05-03 17:13:50 +10:00
evpobr 7a35c52849 cmake: Fix pkg-config install path
Path was accidentally broken in acadefd.

Closes #200.
2020-04-07 18:13:01 +10:00
evpobr dd975a9ea8 Integrate Github Actions 2020-04-07 06:52:26 +10:00
evpobr acadefddac Add more CMake options
* BUILD_PROGRAMS
** INSTALL_MANPAGES
* INSTALL_PKGCONFIG_MODULES
* INSTALL_CMAKE_CONFIG_MODULE
2020-04-05 19:31:40 +10:00
ericLemanissier 1d5299d67b link lm publicly to FLAC 2020-03-06 16:00:17 +11:00
Tamás Zahola cffe3890c7 Fix nullptr dereference in FLAC++ 2019-12-27 11:34:06 +11:00
Vitaliy Kirsanov 0dfe23504c CMake: Handier way to find Iconv 2019-12-22 22:09:03 +11:00
Andrey Astafyev a3d8927c2b Correct printf specifiers to unsigned int where needed 2019-12-09 06:13:11 +11:00
Andrey Astafyev a9d9f4d353 flac: Input file name size calculated just one time 2019-12-08 20:34:57 +11:00
Andrey Astafyev a76bdaab67 replaygain: Fixed usage of gainfilter variable after free 2019-12-08 20:34:57 +11:00
Andrey Astafyev 020042ccd7 flac: Remove variable from expression because it's always equals to false 2019-12-08 20:34:57 +11:00
Andrey Astafyev ec35d55561 libFLAC: Removed useless comparison 2019-12-08 20:34:57 +11:00
Andrey Astafyev 53953b6795 libFLAC++: Fix mistyped identifier name 2019-12-08 20:34:57 +11:00
Andrey Astafyev 1f578f1b71 libFLAC++: Delete decoder and encoder before return if they're not valid 2019-12-08 20:34:57 +11:00
Andrey Astafyev 6455e47721 Both files are checked for EOF 2019-11-30 09:56:17 +11:00
Erik de Castro Lopo b02e159352 libFLAC/bitreader.c: Fix shift invoking undefined behaviour
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19067
Testcase: fuzzer_decoder-5725157960450048
2019-11-24 19:30:34 +11:00
Erik de Castro Lopo d518e13a1f libFLAC/bitreader.c: Fix shift invoking undefined behaviour
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19036
Testcase: fuzzer_decoder-5679084202098688
2019-11-22 06:20:49 +11:00
NotTsunami f706f28322 cmake/configure.ac: Enable -fstack-protector-strong by default
This commit contains the following changes:

- Drops -fstack-protector in favor of -fstack-protector-strong.
  Consequently, the ssp-buffer-size parameter has been removed as
  -fstack-protector-strong ignores array size.

- Add new global opt-out for stack smash protection. This is enabled
  by default for both autotools and CMake builds. Users can opt out
  of stack smash protection by passing -DWITH_STACK_PROTECTOR=OFF to
  CMake or --disable-stack-smash-protection when running ./configure.

- Renames HAVE_SSP_FLAG to HAVE_STACK_PROTECTOR_FLAG in
  CMakeLists.txt to be more readable.
2019-11-20 17:12:03 +11:00
NotTsunami 1640e10e43 lib.mk: Remove incorrect u flag from ar
We work in deterministic mode by default, so timestamps are zeroed,
thus it is impossible to check timestamps and insert only newer
members. Silences the following autotools warning:

ar: `u' modifier ignored since `D' is the default (see `U')

https://sourceware.org/binutils/docs/binutils/ar-cmdline.html
2019-11-20 14:04:42 +11:00
NotTsunami 3bb5d8cd76 include: Escape number signs to suppress warnings
Doxygen sees '#' as a cross-reference, which this is not in this case. This will silence the following warning that pops up frequently when building with docs:

warning: explicit link request to 'defines' could not be resolved

The code shorthand tag was removed in include\FLAC\all.h to remain synonymous with other mentions of #define.
2019-11-19 16:14:47 +11:00
NotTsunami 3a151a207b doc: Update to Doxygen 1.7.6.1
This will bring our doxyfile closer to the modern world and clean up some warnings in the doxygen output during a regular build. I believe it is pretty fair to use 1.7.6.1 given it released in 2011, with the 1.7.x branch a year prior. The current branch is 1.8, which released 2012, but I believe 1.7.6.1 is sufficient.

Updated by running doxygen -u doc/Doxygen.in with Doxygen 1.7.6.1. The only manual change was adding 'Free Lossless Audio Codec' to PROJECT_BRIEF.
2019-11-19 16:14:47 +11:00
Erik de Castro Lopo 1f059e848d libFLAC/bitreader.c: Fix shift invoking undefined behaviour
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18535
Testcase: fuzzer_decoder-6573800707063808
2019-11-19 06:10:19 +11:00
DeadSix27 ed1b67b9a8 cmake: use proper pkg-config install path variable 2019-11-18 15:24:06 +11:00
Erik de Castro Lopo e0f7e0ece5 oss-fuzz: Add fuzzing targets
These fuzzing targets were originally from:

    https://github.com/guidovranken/flac-fuzzers.git

but having them in a separate repo was a huge pain in the neck when
working on fixing any problems found.
2019-11-18 06:29:10 +11:00
Erik de Castro Lopo b19f3a6114 oss-fuzz: Add fuzzing headers
These includes header files were taken from:

    https://github.com/guidovranken/fuzzing-headers.git

with some minor changes required to make them compile cleanly
with the extra compiler warning flags used by the FLAC build
system.
2019-11-18 06:29:10 +11:00
Erik de Castro Lopo 888ea869a7 libFLAC++: Add libFLAC++-static.la target for oss-fuzzers 2019-11-18 06:29:10 +11:00
sezero cdcf0d5575 cmake_minimum_required() cleanup:
- document version requirements in the top-level file.
- remove incorrect version requirements from sub-dirs.
- set min. required version to 3.5 in top-level file.
- set minimun required version to 3.9 under docs/ .
- make documents building an option (on by default.)
  so, the tree can be built using cmake-3.5 using
 -DBUILD_DOCS=0 on the command line.
2019-11-15 19:06:58 +11:00
sezero 2907d4921c flac/main.c: replace an snprintf() call with flac_snprintf()
flac_snprintf() is used everywhere else in there. that single instance
of plain snprintf() was added in commit 04974d27. fixes flac.exe build
with older msvc versions.
2019-11-11 14:14:46 +11:00
Erik de Castro Lopo b3f55c40cc libFLAC/bitreader.c: Fix shift invoking undefined behaviour
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18589
Testcase: fuzzer_decoder-5668806471188480
2019-11-11 11:42:34 +11:00
Erik de Castro Lopo c7d3bd80cf test_streams: Fix UBSAN error in random generator 2019-11-11 11:42:34 +11:00
Hakan Kvist b84ff55b03 libFLAC/stream_decoder.c: fix integer overflow on corrupt file
Corrupt metadata could make the length calculation overflow.
2019-10-24 06:57:47 +11:00
sezero 25305d685b Fix msvc build after commit b917d456
Closes: https://github.com/xiph/flac/issues/152
2019-10-19 14:51:05 +11:00
NY00123 7bc7aebc7c Replace unsigned with uint32_t in prototypes; Fixes DJGPP builds. 2019-10-19 12:51:38 +11:00
Erik de Castro Lopo 35b369ebee travis: Add a brew update 2019-10-16 16:42:11 +11:00
sezero 952d511655 cmake: fix nasm sources build when building in a separate directory
When building in the same directory as the source, it works, but not in
a separate directory.  The trailing slash is important with nasm.  Note
that include_directories("${CMAKE_CURRENT_SOURCE_DIR}/") does not work
because cmake seems to strip the trailing slash.

Also relax the cmake version requirement from 3.12 to 3.9 as everywhere
else in the tree: it works just fine.
2019-10-10 18:32:21 +11:00
sezero d4a1b345dd configure.ac: allow several compiler flags for clang
The flac configury marked clang as 'not being gcc' and excluded
a lot of compiler switches, most importantly the visibility flags,
from being used with it. This was done possibly after a problem
reported at: https://github.com/erikd/libsndfile/issues/49 .

This patch does the following:

- m4/gcc_version.m4 (XIPH_GCC_VERSION): set GCC_MAJOR_VERSION and
  GCC_MINOR_VERSION to 0 for non-gcc. Previously, they were left
  unset.

- configure: the gcc version checks are, naturally, against non-
  zero values, so, allow many compiler switches to be used with
  clang without affecting real-gcc cases.

- configure: When setting CFLAGS="-O3 -funroll-loops", also set
  CXXFLAGS="-O3".  Prevents g++ warnings with _FORTIFY_SOURCE, i.e.:
 '_FORTIFY_SOURCE requires compiling with optimization (-O)'

Tested compilation using gcc-7.3.1 and clang-5.0.2 on x86_64-linux,
and gcc-4.4.7 and clang-3.4.2 on an i686-linux.  Also tested cross-
compiling for Mac OS X using clang-5.0.2.
2019-10-10 18:31:26 +11:00
sezero ee70d96932 cmake: do not add visibility attributes to shared lib builds for win32. 2019-10-10 18:30:39 +11:00
sezero b917d456d2 make dllexport work with compilers other than MSVC
the issue is, flac and metaflac exes rely on flac_internal_???_utf8()
procedures from windows_unicode_filenames.c and there is no easy way
to exclude them from exports without breaking things. So export them
explicitly (they are exported anyway w/o this patch), but add a FIXME
note about the kludge in windows_unicode_filenames.c.
2019-10-10 18:30:39 +11:00
sezero 19a0e99ac3 move the new public get_decoder_client_data function to public header. 2019-10-10 06:09:21 +11:00
Erik de Castro Lopo 2e7931c27e libFLAC/bitreader.c: Fix out-of-bounds read
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17069
Testcase: fuzzer_decoder-5670265022840832
2019-10-08 06:14:06 +11:00
Erik de Castro Lopo 6d0e222a6e Make sure CMake build files end up in release tarball 2019-10-01 08:18:28 +10:00
Erik de Castro Lopo f771c6451b Remove un-needed Makefile.am 2019-10-01 08:18:28 +10:00