4513 Commits

Author SHA1 Message Date
Martijn van Beurden
4b2c33ebf2
Check for overflow in parsing skip/until specification (#584)
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57259
2023-04-10 08:08:54 +02:00
Martijn van Beurden
f191bc3d6c Silence Clang warnings, see commit be1df40 for details 2023-04-08 09:21:03 +02:00
Martijn van Beurden
851c0b9c15 Fix another leak in metaflac
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57362
2023-04-08 09:21:03 +02:00
Martijn van Beurden
499f85f9bc Also let stream_decoder not return NULL vorbiscomment entries
See commit e5c7144 for similar fixes.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57411
2023-04-08 09:21:03 +02:00
Martijn van Beurden
775d214cdd Fix leak in metaflac
This leak seems to have been introduced by b3b9176

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57641
2023-04-08 09:21:03 +02:00
orbea
bacc9d8c66 getopt: Fix the build with clang-16
Clang-16 no longer allows these legacy declarations.
2023-04-01 10:13:04 +02:00
Zhipeng Xue
9ee21a0e68
Fix potential dead store 2023-03-28 07:07:06 +02:00
Martijn van Beurden
43bc8101ce Switch default bitreader/bitwriter word size to 64-bit 2023-03-27 22:10:00 +02:00
Martijn van Beurden
00cb41ee03 Add use of x86 BMI2 to bitreader_read_rice_signed_block 2023-03-27 22:10:00 +02:00
Martijn van Beurden
75d596a234
Only calculate mid-side signal when necessary (#567)
The calculation of the mid-side signal components is moved, so this
is only performed when necessary. This gives a speed up of about
2% for preset 1 on a representative sample
2023-03-27 11:58:49 +02:00
Martijn van Beurden
68f605bd28
Fix mistakes in _compute_best_predictor_limit_residual_intrin_* (#572)
I made a few mistakes in these functions, adding instead of or-ing
and xor-ing instead of or-ing. The issue linked below seems to
relate to something completely different, but it is in fact a
result of triggering these mistakes further down the line.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57071
2023-03-20 19:21:23 +01:00
Martijn van Beurden
6633d2f9bf Set stdin/stdout to binary on Windows for binary input/output
Also fix tests on Windows
2023-03-19 22:37:40 +01:00
Martijn van Beurden
c10b059588 Limit hexdump characters to what is allowed in UTF-8
CI tests failed on MacOS printf using a non-UTF8 locale, printing
characters for bytes values above 127. To have a consistent
interface, only print characters with a byte value lower than
128.
2023-03-19 22:37:40 +01:00
Martijn van Beurden
6fa51a7acc Fix error of metaflac --append testing, add troubleshooting 2023-03-19 22:37:40 +01:00
Martijn van Beurden
436a3577dc Add tests for metaflac --append 2023-03-19 22:37:40 +01:00
Martijn van Beurden
0b3d86ebc3 Check is_last flags on writing a chain 2023-03-19 22:37:40 +01:00
Martijn van Beurden
21bf406fda Add checks so metaflac --append doesn't create invalid files
Checks are added that no streaminfo or seektable blocks can be
added, and no vorbis comment block is one already exists
2023-03-19 22:37:40 +01:00
Martijn van Beurden
8e563a697d Add --append option to metaflac 2023-03-19 22:37:40 +01:00
Martijn van Beurden
b11677e052 Add API function FLAC__metadata_object_set_raw
Add an API function to directly input binary FLAC data to get a
FLAC__StreamMetadata struct. The use mirrors
FLAC__metadata_object_get_raw
2023-03-19 22:37:40 +01:00
Martijn van Beurden
904d027518 Add test for metaflac --data-format=binary-headerless 2023-03-19 22:37:40 +01:00
Martijn van Beurden
b3b9176330 Add data-format option to metaflac, enabling binary output 2023-03-19 22:37:40 +01:00
Martijn van Beurden
b54eabdf0d Add API function FLAC__metadata_object_get_raw
Add an API function to directly output binary FLAC data corresponding
to a certain FLAC__StreamMetadata struct
2023-03-19 22:37:40 +01:00
Martijn van Beurden
eed37c39fa Enable fuzzer_tool_metaflac to fuzz with stdin 2023-03-19 18:31:16 +01:00
Martijn van Beurden
5b145aff12 Convert asserts into explicit checks
An assert checking whether the bit depth of a FLAC file was valid
was triggered by fuzzing. This assert is converted to a explicit
check.

Similarly, an assert was triggered with a file of sample rate 0
when trying to add seekpoints spaced with seconds.
2023-03-19 18:31:16 +01:00
Martijn van Beurden
b5c763d908 Fix double free in iconvert code 2023-03-19 18:31:16 +01:00
Martijn van Beurden
eba4b6f63b Check whether exceeding max seekpoints on growing seektable 2023-03-19 18:31:16 +01:00
Martijn van Beurden
ae1db7147a Fix problems reading vorbis comment data being ignored 2023-03-19 18:31:16 +01:00
Martijn van Beurden
ac39a0078d Improve fuzzer_tool_metaflac 2023-03-19 18:31:16 +01:00
Martijn van Beurden
2568bf69aa Fix metaflac memory leak 2023-03-19 18:31:16 +01:00
Martijn van Beurden
5f39e88a88 Fix strlen being used on uninitialized data 2023-03-19 18:31:16 +01:00
Martijn van Beurden
cad22e0e3a Prevent strcmp being used on invalid data 2023-03-19 18:31:16 +01:00
Martijn van Beurden
67d2e1ee4c Add fuzzer for metaflac command-line tool 2023-03-19 18:31:16 +01:00
Martijn van Beurden
e683286bb4 Add use of stdin to fuzzer_tool_flac, and redirect stdout 2023-03-18 22:55:35 +01:00
Martijn van Beurden
0e1535ccce Check for invalid blocksize (65536) 2023-03-18 22:55:35 +01:00
Martijn van Beurden
f4220895bb Fix null dereference
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57032
2023-03-18 22:55:35 +01:00
Martijn van Beurden
9593b949c2 Try to unblock fuzzer_tool_flac by resetting global variables 2023-03-18 22:55:35 +01:00
Harish Mahendrakar
9c83e6e434 Add missing *local_fixed_compute_best_predictor_wide member 2023-03-11 15:47:17 +01:00
Martijn van Beurden
383512d551 Try to make tool_flac fuzzer not only fuzz with arguments 2023-03-09 14:31:49 +01:00
Martijn van Beurden
6db29d1050 Check for got_stream_info instead of samplerate being 0
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56427
2023-03-09 14:31:49 +01:00
Martijn van Beurden
4d6d8b342f
Speed up set_partitioned_rice_ 2023-03-08 12:26:44 +01:00
Martijn van Beurden
e2faeb80ec Check for 0 samples before outputting gnuplot data
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56339
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56374
2023-03-07 06:49:45 +01:00
Martijn van Beurden
07471c89e7 Swap small and large loop for further speed up in format_input 2023-03-06 11:15:02 +01:00
Martijn van Beurden
724a8aa32e Further speed up format_input for 24-bit PCM by about 25% 2023-03-06 11:15:02 +01:00
Martijn van Beurden
6884355d87 Speed up format_input for 24-bit PCM by 50% 2023-03-06 11:15:02 +01:00
Martijn van Beurden
2b66d94b34 Speed up format_input for 32-bit PCM 2023-03-06 11:15:02 +01:00
Martijn van Beurden
2b84e8593d Write SANE extended zero to remove assert
Simply ignoring this assert (as production code does) results in
an endless loop.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56323
2023-03-03 16:35:31 +01:00
Martijn van Beurden
fe19b113a9 Fix use of undefined value in flac
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56327
2023-03-03 16:35:31 +01:00
Martijn van Beurden
3857234f2b Fix memory leak in flac on foreign metadata object
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56305
2023-03-03 16:35:31 +01:00
Martijn van Beurden
4d21da1183 Add FLAC__fixed_compute_best_predictor_limit_residual_intrin_avx2
This function seems to execute twice as fast as
FLAC__fixed_compute_best_predictor_limit_residual_intrin_sse42 and
5x as fast as plain C
2023-02-27 17:22:17 +01:00
Martijn van Beurden
d24b45515e Add fixed_compute_best_predictor_limit_residual_intrin_sse42
I couldn't find a fixed_compute_best_predictor_wide_intrin_sse42
that was faster than plain C, but I was able to find a working
variant for this function. Execution time is halved.
2023-02-27 17:22:17 +01:00