mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge #20065: fuzz: Configure check for main function
fae7a1c18803675e70b9bf66575e1e0a6e01f6f6 fuzz: Configure check for main function (MarcoFalke) Pull request description: Instead of the PP jungle, use a proper configure check Fixes https://github.com/google/honggfuzz/issues/336#issuecomment-702972138 ACKs for top commit: practicalswift: ACK fae7a1c18803675e70b9bf66575e1e0a6e01f6f6 Tree-SHA512: 2e55457d01f9ac598bb1e119d8b49dca55a28f88ec164cee6b5f071c29e9791f5a46cc8ee2b801b3a3faf906348da964ce32e7254da981c1104b9210a3508100
This commit is contained in:
parent
ca5cb456dd
commit
c4567ce9d4
14
configure.ac
14
configure.ac
@ -1244,6 +1244,20 @@ if test "x$enable_fuzz" = "xyes"; then
|
|||||||
use_upnp=no
|
use_upnp=no
|
||||||
use_natpmp=no
|
use_natpmp=no
|
||||||
use_zmq=no
|
use_zmq=no
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([whether main function is needed])
|
||||||
|
AX_CHECK_LINK_FLAG(
|
||||||
|
[[-fsanitize=$use_sanitizers]],
|
||||||
|
[AC_MSG_RESULT([no])],
|
||||||
|
[AC_MSG_RESULT([yes])
|
||||||
|
CPPFLAGS="$CPPFLAGS -DPROVIDE_MAIN_FUNCTION"],
|
||||||
|
[],
|
||||||
|
[AC_LANG_PROGRAM([[
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstddef>
|
||||||
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { return 0; }
|
||||||
|
/* unterminated comment to remove the main function ...
|
||||||
|
]],[[]])])
|
||||||
else
|
else
|
||||||
BITCOIN_QT_INIT
|
BITCOIN_QT_INIT
|
||||||
|
|
||||||
|
@ -12,15 +12,6 @@
|
|||||||
|
|
||||||
const std::function<void(const std::string&)> G_TEST_LOG_FUN{};
|
const std::function<void(const std::string&)> G_TEST_LOG_FUN{};
|
||||||
|
|
||||||
// Decide if main(...) should be provided:
|
|
||||||
// * AFL needs main(...) regardless of platform.
|
|
||||||
// * macOS handles __attribute__((weak)) main(...) poorly when linking
|
|
||||||
// against libFuzzer. See https://github.com/bitcoin/bitcoin/pull/18008
|
|
||||||
// for details.
|
|
||||||
#if defined(__AFL_COMPILER) || !defined(MAC_OSX)
|
|
||||||
#define PROVIDE_MAIN_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PROVIDE_MAIN_FUNCTION)
|
#if defined(PROVIDE_MAIN_FUNCTION)
|
||||||
static bool read_stdin(std::vector<uint8_t>& data)
|
static bool read_stdin(std::vector<uint8_t>& data)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user