diff options
Diffstat (limited to 'lib/ubsan')
-rw-r--r-- | lib/ubsan/ubsan_flags.inc | 3 | ||||
-rw-r--r-- | lib/ubsan/ubsan_handlers.cc | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/ubsan/ubsan_flags.inc b/lib/ubsan/ubsan_flags.inc index d171a98e1..1638a054e 100644 --- a/lib/ubsan/ubsan_flags.inc +++ b/lib/ubsan/ubsan_flags.inc @@ -24,3 +24,6 @@ UBSAN_FLAG(bool, print_stacktrace, false, UBSAN_FLAG(const char *, suppressions, "", "Suppressions file name.") UBSAN_FLAG(bool, report_error_type, false, "Print specific error type instead of 'undefined-behavior' in summary.") +UBSAN_FLAG(bool, silence_unsigned_overflow, false, + "Do not print error reports for unsigned integer overflow. " + "Used to provide fuzzing signal without blowing up logs.") diff --git a/lib/ubsan/ubsan_handlers.cc b/lib/ubsan/ubsan_handlers.cc index 59a5a6b72..b48862a9d 100644 --- a/lib/ubsan/ubsan_handlers.cc +++ b/lib/ubsan/ubsan_handlers.cc @@ -15,6 +15,7 @@ #if CAN_SANITIZE_UB #include "ubsan_handlers.h" #include "ubsan_diag.h" +#include "ubsan_flags.h" #include "ubsan_monitor.h" #include "sanitizer_common/sanitizer_common.h" @@ -118,6 +119,9 @@ static void handleIntegerOverflowImpl(OverflowData *Data, ValueHandle LHS, if (ignoreReport(Loc, Opts, ET)) return; + if (!IsSigned && flags()->silence_unsigned_overflow) + return; + ScopedReport R(Opts, Loc, ET); Diag(Loc, DL_Error, ET, "%0 integer overflow: " |