Skip to content

Conversation

@practicalswift
Copy link
Contributor

Don't assume presence of __builtin_mul_overflow(…) in MultiplicationOverflow(…) fuzzing harness.

Fixes #18389.

@naumenkogs
Copy link
Contributor

naumenkogs commented Mar 20, 2020

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:```

@DrahtBot DrahtBot added the Tests label Mar 20, 2020
@practicalswift practicalswift force-pushed the multiplication-overflow-fixup branch from 3748e1d to 5ff2ee1 Compare March 21, 2020 08:24
@practicalswift
Copy link
Contributor Author

@naumenkogs Oh, thanks! Clang-isms now removed :) Please re-review!

@naumenkogs
Copy link
Contributor

naumenkogs commented Mar 21, 2020

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.

@naumenkogs
Copy link
Contributor

naumenkogs commented Mar 21, 2020

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>

@practicalswift practicalswift force-pushed the multiplication-overflow-fixup branch from 5ff2ee1 to 7c1ac70 Compare March 22, 2020 13:29
@practicalswift
Copy link
Contributor Author

@naumenkogs Thanks for testing! Hopefully fixed now. Would you mind testing the latest version? :)

@naumenkogs
Copy link
Contributor

ACK 7c1ac70

@maflcko maflcko merged commit 97b0687 into bitcoin:master Mar 23, 2020
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 20, 2021
…ionOverflow(...) fuzzing harness

Summary:
Backport of core [[bitcoin/bitcoin#18393 | PR18393]].

Depends on D8967.

Test Plan:
I cannot reproduce the issue myself, but I can check it doesn't break
the fuzzer:
  ninja bitcoin-fuzzers
  ./test/fuzz/test_runner.py <path_to_corpus> multiplication_overflow

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D8969
@practicalswift practicalswift deleted the multiplication-overflow-fixup branch April 10, 2021 19:40
kwvg added a commit to kwvg/dash that referenced this pull request Jul 15, 2022
…in MultiplicationOverflow(...) fuzzing harness
PastaPastaPasta added a commit to dashpay/dash that referenced this pull request Jul 17, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fuzzing: compilation error ‘__builtin_mul_overflow’ does not have pointer to integer type

4 participants