From dc4cf79849aeadfd9817fae6f15903c805f523f4 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Fri, 2 Oct 2026 17:43:34 +0000 Subject: [PATCH] fuzzing/fuzzer.cc: return 0 when the input does not open libFuzzer accepts only 0 or -1 from LLVMFuzzerTestOneInput, and a release build treats 1 like -1, so every input that WavpackOpenFileInputEx64() rejected was kept out of the corpus. Co-Authored-By: Claude Opus 5.5 (1M context) --- fuzzing/fuzzer.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fuzzing/fuzzer.cc b/fuzzing/fuzzer.cc index 63aa1495..58e16d43 100644 --- a/fuzzing/fuzzer.cc +++ b/fuzzing/fuzzer.cc @@ -135,7 +135,6 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) char error [80]; int num_chans, bps, mode, qmode; int64_t total_samples; - int retval = 0; times_called++; @@ -147,10 +146,8 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) raw_wv.eptr = raw_wv.dptr + size; wpc = WavpackOpenFileInputEx64 (&raw_reader, &raw_wv, NULL, error, flags, 15); - if (!wpc) { - retval = 1; + if (!wpc) goto exit; - } opens++; num_chans = WavpackGetNumChannels (wpc); @@ -265,7 +262,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) printf ("LLVMFuzzerTestOneInput(): %lld calls, %lld opens, %lld seeks, %lld tag writes, %lld samples, %lld text & %lld binary tags\n", times_called, opens, seeks, tag_writes, samples_decoded, text_tags, binary_tags); - return retval; + return 0; } #ifdef STAND_ALONE_LENGTH // max file length for stand-alone testing (sans fuzz)