Skip to content

Conversation

@freenancial
Copy link
Contributor

@freenancial freenancial commented Jul 21, 2020

fixes #19557

Before the fix:

➜  bitcoin git:(fix-fuzzer-macos) make
Making all in src
  CXX      test/fuzz/addition_overflow-addition_overflow.o
In file included from test/fuzz/addition_overflow.cpp:7:
./test/fuzz/util.h:335:13: error: no matching function for call to 'AdditionOverflow'
        if (AdditionOverflow((uint64_t)fuzzed_file->m_offset, random_bytes.size())) {
            ^~~~~~~~~~~~~~~~
./test/fuzz/util.h:201:16: note: candidate template ignored: deduced conflicting types for parameter 'T' ('unsigned long long' vs. 'unsigned long')
NODISCARD bool AdditionOverflow(const T i, const T j) noexcept
               ^
./test/fuzz/util.h:346:13: error: no matching function for call to 'AdditionOverflow'
        if (AdditionOverflow(fuzzed_file->m_offset, n)) {
            ^~~~~~~~~~~~~~~~
./test/fuzz/util.h:201:16: note: candidate template ignored: deduced conflicting types for parameter 'T' ('long long' vs. 'long')
NODISCARD bool AdditionOverflow(const T i, const T j) noexcept
               ^

After the fix:

➜  bitcoin git:(fix-fuzzer-macos) ./configure --enable-fuzz --with-sanitizers=fuzzer,address,undefined CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ --disable-asm && make clean && make -j5
...
...
  CXXLD    test/fuzz/uint256_deserialize
Making all in doc/man
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all-am'.

@freenancial
Copy link
Contributor Author

freenancial commented Jul 21, 2020

This PR is following the advice of @practicalswift here:
#19557 (comment)

@DrahtBot DrahtBot added the Tests label Jul 21, 2020
@maflcko
Copy link
Member

maflcko commented Jul 22, 2020

review ACK c8992e8

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK c8992e8 - tested that compiling works on macOS.

In future, if you're cherry-picking / contributing somebody else's patch, adding a Co-authored-by: other contributor is appreciated.

@fanquake fanquake merged commit 2031aa9 into bitcoin:master Jul 22, 2020
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Feb 3, 2021
Summary:
```

Before the fix:

➜  bitcoin git:(fix-fuzzer-macos) make
Making all in src
  CXX      test/fuzz/addition_overflow-addition_overflow.o
In file included from test/fuzz/addition_overflow.cpp:7:
./test/fuzz/util.h:335:13: error: no matching function for call to
'AdditionOverflow'
        if (AdditionOverflow((uint64_t)fuzzed_file->m_offset,
random_bytes.size())) {
            ^~~~~~~~~~~~~~~~
./test/fuzz/util.h:201:16: note: candidate template ignored: deduced
conflicting types for parameter 'T' ('unsigned long long' vs. 'unsigned
long')
NODISCARD bool AdditionOverflow(const T i, const T j) noexcept
               ^
./test/fuzz/util.h:346:13: error: no matching function for call to
'AdditionOverflow'
        if (AdditionOverflow(fuzzed_file->m_offset, n)) {
            ^~~~~~~~~~~~~~~~
./test/fuzz/util.h:201:16: note: candidate template ignored: deduced
conflicting types for parameter 'T' ('long long' vs. 'long')
NODISCARD bool AdditionOverflow(const T i, const T j) noexcept
               ^

After the fix:

➜  bitcoin git:(fix-fuzzer-macos) ./configure --enable-fuzz
--with-sanitizers=fuzzer,address,undefined
CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++
--disable-asm && make clean && make -j5
...
...
  CXXLD    test/fuzz/uint256_deserialize
Making all in doc/man
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all-am'.
```

Backport of core [[bitcoin/bitcoin#19562 | PR19562]].

Depends on D9132.

Test Plan:
On OSX:
  ninja bitcoin-fuzzers

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9134
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 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.

test: recently merged fuzzers don't compile on macOS

4 participants