-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
#include <string> | ||
|
||
extern bool rust_miniscript_from_str(const char* miniscript_str); | ||
extern bool rust_bitcoin_script(const char* miniscript_str); | ||
extern char* rust_bitcoin_psbt(const char* miniscript_str); | ||
extern bool rust_bitcoin_script(const uint8_t *data, size_t len); | ||
extern char* rust_bitcoin_psbt(const uint8_t *data, size_t len); | ||
extern char* rust_miniscript_from_str_check_key(const char* miniscript_str); | ||
extern char* rust_bitcoin_des_block(const uint8_t *data, size_t len); | ||
extern char* rust_bitcoin_prefilledtransaction(const uint8_t *data, size_t len); | ||
extern bool rust_bitcoin_net_address(uint8_t *data, size_t len); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <fuzzer/FuzzedDataProvider.h> | ||
#include <string> | ||
#include <iostream> | ||
#include <stdio.h> | ||
|
||
#include "netaddress.h" | ||
#include "bitcoin/src/netaddress.h" | ||
#include "bitcoin/src/streams.h" | ||
|
||
extern "C" bool rust_bitcoin_net_address(uint8_t *data, size_t len); | ||
|
||
bool NetAddressCore(Span<const uint8_t> buffer) | ||
{ | ||
DataStream ds{buffer}; | ||
CNetAddr net_addr; | ||
try { | ||
ds >> CNetAddr::SerParams{CNetAddr::Encoding::V2}(net_addr); | ||
if (net_addr.ToStringAddr() == "::") return false; | ||
} catch (const std::ios_base::failure& e) { | ||
return false; | ||
} | ||
return net_addr.IsValid(); | ||
} | ||
|
||
|
||
void NetAddress(FuzzedDataProvider& provider) | ||
{ | ||
std::vector<uint8_t> buffer{provider.ConsumeRemainingBytes<uint8_t>()}; | ||
bool core{NetAddressCore(buffer)}; | ||
bool rust_bitcoin{rust_bitcoin_net_address(buffer.data(), buffer.size())}; | ||
if (core) assert(rust_bitcoin); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef NET_ADDRESS_H | ||
#define NET_ADDRESS_H | ||
|
||
#include <fuzzer/FuzzedDataProvider.h> | ||
|
||
void NetAddress(FuzzedDataProvider& provider); | ||
#endif |