From 9a492bcc8bb75ff07c73a704fd275de945971dfd Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Wed, 10 Jul 2024 14:40:34 +0200 Subject: [PATCH 1/2] Remove unnecessary assert condition Credit: Oss-Fuzz Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60777 --- src/share/grabbag/replaygain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/grabbag/replaygain.c b/src/share/grabbag/replaygain.c index 32c9603182..acf502e179 100644 --- a/src/share/grabbag/replaygain.c +++ b/src/share/grabbag/replaygain.c @@ -139,8 +139,8 @@ FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__ FLAC__int32 block_peak = 0, s; uint32_t i, j; - FLAC__ASSERT(bps >= FLAC__MIN_BITS_PER_SAMPLE && bps <= FLAC__MAX_BITS_PER_SAMPLE); - FLAC__ASSERT(FLAC__MIN_BITS_PER_SAMPLE == 4 && FLAC__MAX_BITS_PER_SAMPLE == 32); + FLAC__ASSERT(bps > 0 && bps <= FLAC__MAX_BITS_PER_SAMPLE); + FLAC__ASSERT(FLAC__MAX_BITS_PER_SAMPLE == 32); if(bps == 16) { if(is_stereo) { From a6a9450ddcf9b22cbc6990a27f29b155eef92303 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Wed, 10 Jul 2024 15:34:24 +0200 Subject: [PATCH 2/2] Address two Clang warnings --- include/share/alloc.h | 2 +- src/metaflac/operations.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/share/alloc.h b/include/share/alloc.h index b0da6941dc..248ad10295 100644 --- a/include/share/alloc.h +++ b/include/share/alloc.h @@ -66,7 +66,7 @@ #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION extern int alloc_check_threshold, alloc_check_counter; -static inline int alloc_check() { +static inline int alloc_check(void) { if(alloc_check_threshold == INT32_MAX) return 0; else if(alloc_check_counter++ == alloc_check_threshold) diff --git a/src/metaflac/operations.c b/src/metaflac/operations.c index 65fc6dbd95..a14a290afe 100644 --- a/src/metaflac/operations.c +++ b/src/metaflac/operations.c @@ -758,7 +758,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned flac_printf("%c",block->data.application.data[i]); else { char replacement[4] = {0xef, 0xbf, 0xbd, 0}; /* Unicode replacement character */ - flac_printf(replacement); + flac_printf("%s",replacement); } } }