Don't assume presence of __builtin_mul_overflow(…) in MultiplicationOverflow(…) fuzzing harness.
Fixes #18389.
Don't assume presence of __builtin_mul_overflow(…) in MultiplicationOverflow(…) fuzzing harness.
Fixes #18389.
Using 3748e1daec3f3b597e642d5eb86adb21fade6e36, got this with gcc:
#if defined(__has_builtin) && __has_builtin(__builtin_mul_overflow)
^
In file included from ./util/system.h:22:0,
from ./addrman.h:15,
from test/fuzz/deserialize.cpp:6:```
@naumenkogs Oh, thanks! Clang-isms now removed :) Please re-review!
test/fuzz/multiplication_overflow.cpp: In instantiation of ‘void {anonymous}::TestMultiplicationOverflow(FuzzedDataProvider&) [with T = bool]’:
test/fuzz/multiplication_overflow.cpp:55:58: required from here
test/fuzz/multiplication_overflow.cpp:30:75: error: argument 3 in call to function ‘__builtin_mul_overflow’ does not have pointer to integer type
const bool is_multiplication_overflow_builtin = __builtin_mul_overflow(i, j, &result_builtin);
^
afl-as 2.52b by <lcamtuf@google.com>
I also noticed that I have gcc 5.4.0. Perhaps I should just update my compilers? I dunno what are the expectations.
Updated both compilers, didn't help with this particular issue I mention above.
Update: Alright, got gcc-9.2.1. Seeing this instead:
[+] Instrumented 2039 locations (64-bit, hardened mode, ratio 100%).
test/fuzz/multiplication_overflow.cpp: In instantiation of ‘void {anonymous}::TestMultiplicationOverflow(FuzzedDataProvider&) [with T = bool]’:
test/fuzz/multiplication_overflow.cpp:55:58: required from here
test/fuzz/multiplication_overflow.cpp:30:83: error: argument 3 in call to function ‘__builtin_mul_overflow’ has pointer to boolean type
30 | const bool is_multiplication_overflow_builtin = __builtin_mul_overflow(i, j, &result_builtin);
| ^~~~~~~~~~~~~~
afl-as 2.52b by <lcamtuf@google.com>
@naumenkogs Thanks for testing! Hopefully fixed now. Would you mind testing the latest version? :)
ACK 7c1ac70