Commit Graph

4439 Commits

Author SHA1 Message Date
Martijn van Beurden a8c20a6af1 Let --keep-foreign-metadata on decode pick the right decode format 2023-02-17 11:06:46 +01:00
Martijn van Beurden a12c6f3236 Add more precise format detection in stored foreign metadata 2023-02-17 11:06:46 +01:00
Martijn van Beurden 1ef4120c93 Check stored foreign metadata chunks
When foreign metadata is being restored, the master chunk and the
format chunk (and similar) are skipped over. This commit adds code
checking whether the stored chunk agrees with what is written.

This will catch cases where a legacy wave format file has been
stored to FLAC with --keep-foreign-metadata, but is being restored
to WAVE_FORMAT_EXTENSIBLE, or AIFF-C to AIFF. Also, it will reveal
when a FLAC file has been changed in length, or had an invalid
format chunk
2023-02-17 11:06:46 +01:00
Martijn van Beurden 3f1f82c8fa
Fix warning in test suite, introduced in a87e6b
Recently a warning was added to libFLAC when RIFF header doesn't
match the filesize. It turns out that warning is trigger by a very
old (harmless) bug in the test suite file generator
2023-02-11 09:42:11 +01:00
Martijn van Beurden aaffdcaa96
Fix running several tests in parallel with CTest
This only fixes CTest, it does not make it possible to run tests
in parallel with make
2023-02-11 09:04:45 +01:00
Martijn van Beurden 748f3938e2
Add warnings for max pathlength 2023-01-29 20:39:43 +01:00
Martijn van Beurden ba5172e554
Remove all PPC-specific code (and a mention of SPARC)
As it turns out that the PPC-specific code provides no benefit with
modern, autovectorizing compilers, and given that there is a lot of
cruft surrounding the PPC-specific parts, remove all of it.

See also https://lists.xiph.org/pipermail/flac-dev/2022-December/006620.html
2023-01-27 19:02:36 +01:00
Martijn van Beurden fe0bf2309a
Lift restrictions on channel mask
See also https://github.com/ietf-wg-cellar/flac-specification/pull/182
2023-01-09 11:00:51 +01:00
Martijn van Beurden 6ea23b0fd3
Remove 'default is signed' mention for raw input 2023-01-09 10:50:40 +01:00
Martijn van Beurden 0a52c6fd5c
Replace own bool with stdbool.h, check for header being available 2023-01-07 09:58:00 +01:00
Martijn van Beurden 2b87e4cd25
Let libFLAC not write a seektable in Ogg, even when asked for
The seektable libFLAC currently writes does not conform to
https://datatracker.ietf.org/doc/draft-ietf-cellar-flac/07/ and
it probably isn't used anywhere, so the code writing it is removed
2023-01-06 19:34:57 +01:00
Martijn van Beurden 8d2830b6a9
Refactor code applying apodization and finding lp_coeffs (#530)
This code was rather hard to read. By separating it from the other
logic steering the lpc subframe evaluation, readability should
improve.
2022-12-31 22:16:01 +01:00
Martijn van Beurden 9b7ca112e9
Fix segfault introduced in commit 3975b3e
A read from the input file was attempted without checking whether
opening it was succesful.
2022-12-02 10:05:45 +01:00
Sam James 7844578995
libFLAC.m4, libFLAC++.m4: fix -Wstrict-prototypes (#521) 2022-11-28 22:13:26 +01:00
Martijn van Beurden c42d4467d5
Remove unused include of safe_str.h 2022-11-28 18:48:12 +01:00
Martijn van Beurden 7270930e9e Fix partial windowing of 33 bps subframes 2022-11-16 22:04:52 +01:00
Martijn van Beurden 153c82d5b5 Mark some functions as unused
- FLAC__bitwriter_rice_bits
- FLAC__format_get_max_rice_partition_order
2022-11-16 22:04:52 +01:00
Martijn van Beurden 1cb59f0b0f Move bitreader_dump and bitwriter_dump functions to test_libFLAC 2022-11-16 22:04:52 +01:00
Martijn van Beurden 5663f11795
Check number of metadata blocks
Fixes out-of-bounds access

Credit: Oss-Fuzz
2022-11-16 20:16:26 +01:00
Martijn van Beurden 36bba3befb Check length of written metadata block in stream encoder framing 2022-11-15 22:06:41 +01:00
Martijn van Beurden 7ab61a7b29 Add more checks to metadata
The decoder hands over faulty metadata blocks to the encoder, which
then aborts because of an assert in the verifier
2022-11-15 22:06:41 +01:00
Martijn van Beurden 59195461b6 Add fuzzer_reencoder 2022-11-15 22:06:41 +01:00
Martijn van Beurden 9e3d1666c1 Add subdivide_tukey to encoder fuzzer dictionary 2022-11-13 22:41:18 +01:00
Martijn van Beurden 76e8f22b4c Clean up and add to fuzzer_encoder (v1)
Now fuzzer_encoder_v2 has been running for quite some time and no
big (encoder) projects are coming, fuzzer_encoder is changed. This
will invalidate the current corpus which will take time to rebuild,
but I think this is a good moment to do so.
2022-11-13 22:41:18 +01:00
Martijn van Beurden e91bbb4e28 Add FLAC__stream_encoder_set_limit_min_bitrate to fuzzer_encoder_v2 2022-11-13 22:41:18 +01:00
Martijn van Beurden d3c1e3e6c3 Mark FLAC__bitwriter_write_rice_signed as unused 2022-11-13 22:41:18 +01:00
Martijn van Beurden e52161830d Remove FLAC__memory_alloc_aligned_unsigned_array
Replace with otherwise unused FLAC__memory_alloc_aligned_uint32_array
2022-11-13 22:41:18 +01:00
Martijn van Beurden 6317031cc0
Improve fuzz coverage for stream_encoder.c 2022-11-12 12:39:21 +01:00
Mark Grassi c204c0bdb5
Remove repeated .gitignore pattern 2022-11-12 10:16:23 +01:00
Martijn van Beurden 1d3d5d98b6
Improve fuzzer_encoder_v2 coverage: add picture and unkown metadata 2022-11-11 21:36:32 +01:00
Martijn van Beurden a7b22e9edb
Improve fuzzer_encoder_v2 coverage: add cuesheet 2022-11-11 07:05:31 +01:00
Martijn van Beurden 96b5e6d35a Check vorbis comment entry before copying
Whereas in C vorbis comment fields are in an array, C++ actually
validates the comment before returning it. This means it needs a
little more checking.
2022-11-09 07:19:31 +01:00
Martijn van Beurden 17c7808405 Remove untrue asserts that vorbis comment field must not be empty 2022-11-09 07:19:31 +01:00
Martijn van Beurden b543ca9502 Only check asserts when file rewrite succeeded 2022-11-09 07:19:31 +01:00
Martijn van Beurden abdcb80bf8 Add checks for simple iterator status 2022-11-09 07:19:31 +01:00
Martijn van Beurden 52c28c7178 Add bunch of asserts checking simple iterator status 2022-11-09 07:19:31 +01:00
Martijn van Beurden ad01d796af Remove assert number of fields in vorbis_comments > 0
The assert doesn't serve any function, because the number of
vorbis comment fields being 0 is handled just fine
2022-11-09 07:19:31 +01:00
Martijn van Beurden d3751a0a47 Add checks that metadata is valid 2022-11-09 07:19:31 +01:00
Martijn van Beurden 46bf04d0d7 Properly handle wasted_bits > bps
When a subframe was read which had wasted_bits > bps, processing
wasn't properly stopped. Instead of throwing an error and setting
decoder state, it just returned false.
2022-11-09 07:19:31 +01:00
Martijn van Beurden 07b5d9032f Remove asserts for conditions that are checked anyway 2022-11-09 07:19:31 +01:00
Martijn van Beurden a73e70c8f4 Also check asserts in fuzzing 2022-11-09 07:19:31 +01:00
harridu 0ab961de52
add option metaflac --show-all-tags
Co-authored-by: Martijn van Beurden <mvanb1@gmail.com>
2022-11-08 17:09:22 +01:00
Martijn van Beurden 20d8b0f50c
Add --remove-all-tags-except to metaflac 2022-11-08 13:23:00 +01:00
Martijn van Beurden a87e6ba5f4
Warn for data trailing the data chunk 2022-11-08 10:17:02 +01:00
Martijn van Beurden 29b57b59a4
Fix memleak in test_libFLAC introduced in commit 10e34d4 2022-11-07 07:16:17 +01:00
Martijn van Beurden eb5bac33f9
Only prepend default CFLAGS for GCC and Clang 2022-11-06 19:12:34 +01:00
Mark Grassi dff58b4b8d
Clarify ReplayGain requirements 2022-11-06 10:19:49 +01:00
Martijn van Beurden 3975b3e6a2
Check for ID3v2 tag when using flac -t 2022-11-04 17:03:48 +01:00
Martijn van Beurden 9ca1e062c2
Add --force-legacy-wave-format option to flac command line program 2022-11-04 06:54:01 +01:00
Martijn van Beurden 3fe6219c68
Fix encoder not deleting output after error on Windows
When `flac` was invoked as an encoder and stumbled on an error, it would first try to unlink the file and only then finish encoding. This works fine on *nix but fails on Windows. With this commit, the encoder session is first destroyed and only then the file is 'unlinked'.
2022-11-03 21:45:56 +01:00