Martijn van Beurden
b698ed45f3
Rewrite FLAC__bitwriter_write_rice_signed_block for 32 bit words
...
Using a very different approach: instead of trying to write a full
32-bit bitwriter word, a 64-bit buffer is filled, of which the
first 32 bits are copied to the bitwriter as soon as they are
filled. This way, only very large symbols have to be splitted.
This approach is considerably simpler, and the fast path is taken
much more often.
2023-02-26 15:10:10 +01:00
Zhipeng Xue
a336ea5264
Fix potential resource leak
2023-02-24 21:58:45 +01:00
Martijn van Beurden
9382c5375b
Add checks on re-encoding FLAC
...
While decoding from FLAC checks for changes no. of channels, bps
and sample rate, re-encoding doesn't. A fuzzer found use of
uninitialized memory because of this. A few checks are added,
although the user isn't warned on a samplerate change.
2023-02-23 06:59:11 +01:00
Martijn van Beurden
14f19cb245
Fix undefined behaviour in chunk size reading
2023-02-23 06:59:11 +01:00
Martijn van Beurden
da3254a72a
Fix null dereference read
2023-02-23 06:59:11 +01:00
Martijn van Beurden
67a0a153ca
Fix oss-build problem and add fuzzer_tool_flac to .gitignore
2023-02-23 06:59:11 +01:00
Jake Schmidt
0408d2518d
In metaflac/usage.c, add missing newlines in the --remove-all-tags-except description
2023-02-22 07:22:28 +01:00
Martijn van Beurden
2d34861226
Fix mistake in preparing for fuzzer_tool_flac
2023-02-22 03:18:20 +01:00
Martijn van Beurden
b318f29869
Increase CI-fuzz time spend
2023-02-22 03:18:20 +01:00
Martijn van Beurden
1a8279b7d1
Fix some fuzz finds in grabbag picture code
...
- Check for chunk length overflow in PNG reading code
- Check for empty file
- Check for empty URL
2023-02-22 03:18:20 +01:00
Martijn van Beurden
21ffc935f0
Add fuzzer for flac command-line tool
...
Up until now, only libFLAC was being fuzzed. This commit adds a
fuzzer capable of fuzzing most code of the flac executable
2023-02-22 03:18:20 +01:00
Martijn van Beurden
d52921bc0b
Disable signed int overflow sanitizer in hotspots by default
...
See https://github.com/xiph/flac/issues/546
2023-02-21 15:56:40 +01:00
Martijn van Beurden
8daf62da0c
Rename fuzzer source files to simplify oss-fuzz build script
2023-02-21 15:56:40 +01:00
Martijn van Beurden
3baaf23faa
Add warning that md5 functions are used elsewhere
2023-02-21 08:16:46 +01:00
Martijn van Beurden
771eb050e7
Add tests for foreign metadata handling
2023-02-17 11:06:46 +01:00
Martijn van Beurden
625acf4f37
Document that FLAC pick output format with --keep-foreign-metadata
2023-02-17 11:06:46 +01:00
Martijn van Beurden
285a3f554a
Split up writing metadata and comparing metadata into separate steps
...
For some reason it is possible to read and write in the same file
when opened with fopen mode r+b on linux, but not on MacOS. Reading
and 'verifying' is now split up into two steps, which does work.
Additional benefit is that all foreign metadata is written first,
before verifying, which means as much data as possible is restored.
The error messages also more clearly state whether things went wrong
copying or verifying.
2023-02-17 11:06:46 +01:00
Martijn van Beurden
7ea43e3ba4
Fix some bugs from recent foreign metadata improvements
2023-02-17 11:06:46 +01:00
Martijn van Beurden
92b5292d65
Restore compression type name to AIFF-C from foreign metadata
2023-02-17 11:06:46 +01:00
Martijn van Beurden
692f2ebe93
Add support for decoding to AIFF-C NONE and sowt
...
Also, add the option to force decoding to WAVE_FORMAT_EXTENSIBLE
2023-02-17 11:06:46 +01:00
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