Skip to content

Commit

Permalink
fuzz: increase FromHex() coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
stickies-v committed Jul 31, 2024
1 parent 526a87b commit 9a0b2a6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test/fuzz/hex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <uint256.h>
#include <univalue.h>
#include <util/strencodings.h>
#include <util/transaction_identifier.h>

#include <cassert>
#include <cstdint>
Expand All @@ -27,7 +28,11 @@ FUZZ_TARGET(hex)
assert(ToLower(random_hex_string) == hex_data);
}
(void)IsHexNumber(random_hex_string);
(void)uint256::FromHex(random_hex_string);
if (uint256::FromHex(random_hex_string)) {
assert(random_hex_string.length() == 64);
assert(Txid::FromHex(random_hex_string));
assert(Wtxid::FromHex(random_hex_string));
}
(void)uint256S(random_hex_string);
try {
(void)HexToPubKey(random_hex_string);
Expand Down

0 comments on commit 9a0b2a6

Please sign in to comment.