From 9e143766ca7e9eae7bd412e48d2d9d222646ad52 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Tue, 10 May 2022 20:10:42 +0200 Subject: [PATCH] Only locally disable signed integer sanitizing on decoder fuzzers See https://github.com/google/oss-fuzz/pull/7687 --- src/libFLAC/fixed.c | 2 +- src/libFLAC/lpc.c | 3 ++- src/libFLAC/stream_decoder.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libFLAC/fixed.c b/src/libFLAC/fixed.c index 9e53f299d1..dcb71c5309 100644 --- a/src/libFLAC/fixed.c +++ b/src/libFLAC/fixed.c @@ -375,7 +375,7 @@ void FLAC__fixed_compute_residual(const FLAC__int32 data[], uint32_t data_len, u } } -#if defined(__clang__) +#ifdef FUZZING_BUILD_MODE_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW /* The attribute below is to silence the undefined sanitizer of oss-fuzz. * Because fuzzing feeds bogus predictors and residual samples to the * decoder, having overflows in this section is unavoidable. Also, diff --git a/src/libFLAC/lpc.c b/src/libFLAC/lpc.c index ba3ae27225..b2545ad54e 100644 --- a/src/libFLAC/lpc.c +++ b/src/libFLAC/lpc.c @@ -807,7 +807,8 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 * f #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ -#if defined(__clang__) + +#ifdef FUZZING_BUILD_MODE_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW /* The attribute below is to silence the undefined sanitizer of oss-fuzz. * Because fuzzing feeds bogus predictors and residual samples to the * decoder, having overflows in this section is unavoidable. Also, diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index b6def9c95a..c12dfae109 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -2986,7 +2986,7 @@ FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data) */ } -#if defined(__clang__) +#ifdef FUZZING_BUILD_MODE_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW /* The attribute below is to silence the undefined sanitizer of oss-fuzz. * Because fuzzing feeds bogus predictors and residual samples to the * decoder, having overflows in this section is unavoidable. Also,