Commit Graph

4474 Commits

Author SHA1 Message Date
Martijn van Beurden dd288d2f23 Do not fuzz apodizations in flac tool fuzzer
These are already fuzzed elsewhere, so disable fuzzing in the flac
tool fuzzer.
2023-04-24 07:22:54 +02:00
Martijn van Beurden d4daa86167 Check for bps% 8 != 0 if no streaminfo is present
This extends commit c671e1c for cases where streaminfo is not
present.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58277
2023-04-24 07:22:54 +02:00
Martijn van Beurden 5008827b64 Remove files generated during fuzzing of flac tool
CI-Fuzz occassionally runs out of disk space, and there might be
other problems (coverage suddenly vanishing for example) related
to disk space issues. This commit should make sure all files
generated by the flac tool are removed as soon as they are closed.
2023-04-22 16:42:09 +02:00
Martijn van Beurden 9bbdb6be6d Do not set brute-force options on fuzzing flac tool
These options are already fuzzed with the library fuzzers, using
them for the tool will probably not find anything new. This should
reduce the number of timeouts during fuzzing
2023-04-22 16:42:09 +02:00
Martijn van Beurden d2060f48e5 Fix division by zero when handling sample rate == 0
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58142
2023-04-20 11:52:38 +02:00
Martijn van Beurden 798fe376eb Error when skip or until are used on a file without streaminfo
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58031
2023-04-18 22:34:50 +02:00
Martijn van Beurden 29d1460a38 Add more overflow checks to cuesheet parsing
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57315
2023-04-18 22:34:50 +02:00
Martijn van Beurden 1faa4924e2 Treat cuesheets with 0 tracks as invalid
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57904
2023-04-18 07:56:02 +02:00
Martijn van Beurden 139cd330af Allow sample rate == 0, as per IETF spec
See https://www.ietf.org/archive/id/draft-ietf-cellar-flac-08.html#name-streaminfo

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=57456
2023-04-18 07:56:02 +02:00
Martijn van Beurden f8be98e107
Improve overflow checking of commit 4b2c33e 2023-04-17 09:34:57 +02:00
Martijn van Beurden f7bd64bc70
Add help and man text for --append 2023-04-11 10:44:36 +02:00
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