Commit Graph

4509 Commits

Author SHA1 Message Date
Martijn van Beurden 5152c6cace
Add CI for MSYS2, and package build as artifact (#757) 2024-10-30 21:37:40 +01:00
Martijn van Beurden 7f46eb20ab Fix -Wunused-result warning for ID3v1 detection 2024-10-29 19:01:57 +01:00
Martijn van Beurden fd09bbb857 Fix end-of-stream signal not being propagated
Credit: Oss-Fuzz
Issue: https://issues.oss-fuzz.com/issues/370597904
2024-10-29 19:01:57 +01:00
Martijn van Beurden a7d69df653 Add option to metaflac to write to different file 2024-10-28 12:09:10 +01:00
Martijn van Beurden 73b55024d0 Enable libFLAC to write to new file on changing metadata
Previously, altering metadata could only be done rewriting the
file (or with a tempfile with the assumption the tempfile would
replace the existing file). However, there are good reasons to
write a new file instead. One API call is added for that, and
one is changed to enable this.
2024-10-28 12:09:10 +01:00
Martijn van Beurden 3725add64a
Convert unused seekpoints in template to placeholders (#754)
See https://lists.xiph.org/pipermail/flac-dev/2024-October/006671.html
for details
2024-10-15 19:39:19 +02:00
Martijn van Beurden 155e206f02
Speed up undefined behavior fuzzing of decoder (#753) 2024-10-09 07:23:37 +02:00
Martijn van Beurden 2a23a2af84
Address signed integer overflow (#751)
Credit: Oss-Fuzz
Issue: https://issues.oss-fuzz.com/issues/42526392
2024-10-08 14:56:19 +02:00
Martijn van Beurden ed4e1c464e
Don't try to skip link after allocation failure (#752)
Credit: Oss-Fuzz
Issue: https://issues.oss-fuzz.com/issues/371233030
2024-10-08 12:50:23 +02:00
Martijn van Beurden 00a270848c
Free metadata if subsequent allocation fails (#750)
Credit: Oss-Fuzz
Issue: https://issues.oss-fuzz.com/issues/42538223
2024-10-07 14:28:05 +02:00
Martijn van Beurden 86d6de66a4
Disable fuzzer_tool_flac for i386 (#749)
Revert commits ce91056 and 33b9a4a, disable tool_flac fuzzer for
i386 ASAN because weird bugs keep popping up
2024-10-05 20:08:33 +02:00
Martijn van Beurden 50efa0c8cd
Improve allocation of linkdetails, check more often (#748)
Credit: Oss-Fuzz
Issue: https://issues.oss-fuzz.com/issues/370562609
Issue: https://issues.oss-fuzz.com/issues/371068253
2024-10-04 19:04:57 +02:00
Martijn van Beurden 40ca8c73f3
Only fail on memory allocation after initializing other variables (#747)
As this issue was not reproducible, this might not actually be a
fix.

Credit: Oss-Fuzz
Issue: https://issues.oss-fuzz.com/issues/42538252
2024-10-04 13:03:01 +02:00
Martijn van Beurden a89875d8b1
Fix memory leak in flac command line tool (#746)
Credit: Oss-Fuzz
Issue: https://issues.oss-fuzz.com/issues/42538282
2024-09-30 20:52:13 +02:00
Martijn van Beurden e4f1ee9fff
Fix signed integer overflow in seeking code (#745)
Also add some more seeking tests

Credit: Oss-Fuzz
Issue: https://issues.oss-fuzz.com/issues/369652821
2024-09-30 15:56:38 +02:00
Martijn van Beurden b8efde2132
Add two error statuses to the stream decoder for broken files (#744) 2024-09-29 20:17:01 +02:00
Martijn van Beurden d367d6fe92 Bump library version numbers and update ABI dumps 2024-09-27 15:24:19 +02:00
Martijn van Beurden 3f783f7a5d Remove reference to ogg_sync_check
ogg_sync_check is not properly exported by libogg, causing problems
compiling on win32. It can be removed though, as that check is
included already through ogg_sync_buffer.
2024-09-27 15:24:19 +02:00
Martijn van Beurden 4234fa772b Add FLAC__stream_decoder_skip_single_link and use in seeking
This commit adds the capability to find the end of a link through
seeking instead of by reading forward, which should be much more
efficient. It also exposes this capability through the new API
function FLAC__stream_decoder_skip_single_link

This commit includes additions to the test suite and fuzzers
2024-09-27 15:24:19 +02:00
Martijn van Beurden 301ed81691 Save serial numbers of other streams in each link 2024-09-27 15:24:19 +02:00
Martijn van Beurden 2b17af19c8 Do not trigger assert in seeking code when fuzzing 2024-09-27 15:24:19 +02:00
Martijn van Beurden 2ff8e96d42 Add seedcorpus for fuzzer_seek and fix heap overflow 2024-09-27 15:24:19 +02:00
Martijn van Beurden d5a43acbff Reduce chance of ogg serial number collision
When two ogg streams were made with two different calls to `flac`
within the same second, their serial numbers would be the same.
This caused problems with seeking in the test suite. While in
theory, libFLAC should be able to seek in a chained stream with
two equal serial numbers without fail, in practice seeking in
chained streams is hard enough. So, this commit makes sure the
chained test files have links with unequal serial numbers.

Concerning the use of specific casts, shifts and masks: For some
reason, on some platforms, seemingly, saturating arithmetic was
used where overflow was expected, in effect always seeding with
the same number, UINT32_MAX.
2024-09-27 15:24:19 +02:00
Martijn van Beurden 9b5165070b Add support for seeking in multiplexed chained streams 2024-09-27 15:24:19 +02:00
Martijn van Beurden b0712e655b Pick first FLAC bitstream in Ogg instead of any first bitstream 2024-09-27 15:24:19 +02:00
Martijn van Beurden 77ade9c472 Add Github action checking with ogg disabled 2024-09-27 15:24:19 +02:00
Martijn van Beurden c50e4872a6 Add capability to libFLAC to seek in chained streams 2024-09-27 15:24:19 +02:00
Martijn van Beurden f02c6dbfae Add tests for decoding of chained streams 2024-09-27 15:24:19 +02:00
Martijn van Beurden 08cf8a194a Improve decoding of chained streams in flac command line tool 2024-09-27 15:24:19 +02:00
Martijn van Beurden 60e9234c6f Overhaul decoding of chained streams in libFLAC 2024-09-27 15:24:19 +02:00
Martijn van Beurden dd9c48b69c Use Ogg end of stream marker when decode-chained-stream not enabled 2024-09-27 15:24:19 +02:00
philippe44 fbe98a8431 Add capability to decode chained stream to flac command line tool 2024-09-27 15:24:19 +02:00
philippe44 64e3e6e6f0 Add functions to decode chained stream to API
Co-authored-by: Martijn van Beurden <mvanb1@gmail.com>
2024-09-27 15:24:19 +02:00
philippe44 94dbb688cd Add capability to decode chained stream to libFLAC 2024-09-27 15:24:19 +02:00
ziplantil 9dd1b0a6a1
use ogg_page_granulepos to get number of samples written for Ogg FLAC (#743)
Co-authored-by: Martijn van Beurden <mvanb1@gmail.com>
2024-09-26 08:34:04 +02:00
Martijn van Beurden e42f723b12
Remove debug messages (#741)
When compiled with NDEBUG defined, the test suite output was
extremely noisy. As both these debug messages have served me no
use the last few years, it is time to remove them.
2024-09-12 19:04:48 +02:00
Martijn van Beurden d34489c478
Fix overflow when skipping over raw input (#737)
Fixes https://github.com/xiph/flac/issues/655
2024-08-31 20:56:10 +02:00
Martijn van Beurden 4a271d2e9f Add note to metaflac warning about writing to symlinks 2024-08-30 21:02:09 +02:00
Martijn van Beurden 685f4f69d1 Let libFLAC handle symlinks on metadata handling
Without this commit, libFLAC happily overwrites symlinks with
a new file. With this patch, it tries to follow the symlink,
and fails if it points to another filesystem (i.e. when rename
doesn't work)
2024-08-30 21:02:09 +02:00
Martijn van Beurden 348b3a449f
Check for ID3v1 tags (#738) 2024-08-30 11:10:08 +02:00
Martijn van Beurden e2aef0c275
Remove microbench (#736)
This commit removes 'microbench', as it is no longer relevant. For
more information on its former purpose, see
https://lists.xiph.org/pipermail/flac-dev/2015-September/005608.html
2024-08-30 07:33:55 +02:00
Martijn van Beurden b573a36ed8 Polish previous commit: add failure messages and fix memory leaks 2024-08-27 16:34:15 +02:00
Miroslav Lichvar 0adaa03498 Check return code of static_metadata_append()
Fix crash due to ignored memory allocation error in
static_metadata_append().
2024-08-27 16:34:15 +02:00
Martijn van Beurden 4469640b95 Allow alloccheck to keep failing 2024-08-27 16:34:15 +02:00
Jesper Larsson 1880f21066 don't just pass 0 for samples in Ogg/FLAC callback
This is a fix for https://github.com/xiph/flac/issues/661
2024-08-27 08:49:31 +02:00
Martijn van Beurden 8e6498d44d
Improve console output of flac tool (#734)
Fixes various cases of erratic behaviour (most notably output not
starting on the first character of a line). Also, some warnings
and errors now mark the location in the stream where this error
seems to have occured
2024-08-21 15:56:58 +02:00
Martijn van Beurden 192bf227ae
Remove --explain option from flac command line program (#721)
The `flac` command had 4 levels of documentation: short help,
help, explain and manpage. The explain is removed in favour of
referring to the much more comprehensive manpage
2024-07-30 20:41:18 +02:00
Martijn van Beurden ce91056644 Work around i386 ASAN fseek bug
For some reason, i386 ASAN's fseek does not have large file
support, and off_t is actually a 32-bit int
2024-07-25 18:01:02 +02:00
Martijn van Beurden e50c876a1c Do not try to apply replaygain when bps changes
Credit: Oss-Fuzz
Issue: N/A
2024-07-25 18:01:02 +02:00
Martijn van Beurden 33b9a4a765 Work around i386 ASAN null pointer bug
For some reason, i386 ASAN does not copy a pointer somewhere in the
code. Using gdb I get a mention of a synthetic pointer, so perhaps
the compiler instrumented with ASAN thinks this pointer isn't
used. Anyway, commit adds a check for that null pointer which
isn't necessary otherwise and is only activated for i386 ASAN.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58524
2024-07-25 18:01:02 +02:00