18 return rhs == 0 || (rhs > 0 && lhs <=
CScriptNum{std::numeric_limits<int64_t>::max()} - rhs) || (rhs < 0 && lhs >=
CScriptNum{std::numeric_limits<int64_t>::min()} - rhs);
23 return rhs == 0 || (rhs > 0 && lhs >=
CScriptNum{std::numeric_limits<int64_t>::min()} + rhs) || (rhs < 0 && lhs <=
CScriptNum{std::numeric_limits<int64_t>::max()} + rhs);
36 assert((script_num == i) != (script_num != i));
37 assert((script_num <= i) != (script_num > i));
38 assert((script_num >= i) != (script_num < i));
41 if (IsValidAddition(script_num,
CScriptNum{i})) {
42 assert((script_num + i) - i == script_num);
46 if (IsValidSubtraction(script_num,
CScriptNum{i})) {
47 assert((script_num - i) + i == script_num);
52 assert((script_num == random_script_num) != (script_num != random_script_num));
53 assert((script_num <= random_script_num) != (script_num > random_script_num));
54 assert((script_num >= random_script_num) != (script_num < random_script_num));
57 if (IsValidAddition(script_num, random_script_num)) {
58 assert((script_num + random_script_num) - random_script_num == script_num);
62 if (IsValidSubtraction(script_num, random_script_num)) {
63 assert((script_num - random_script_num) + random_script_num == script_num);
68 if (!IsValidAddition(script_num, random_script_num)) {
73 script_num += random_script_num;
77 if (!IsValidSubtraction(script_num, random_script_num)) {
82 script_num -= random_script_num;
85 script_num = script_num & fuzzed_data_provider.
ConsumeIntegral<int64_t>();
94 if (script_num ==
CScriptNum{std::numeric_limits<int64_t>::min()}) {
99 script_num = -script_num;
105 const int64_t random_integer = fuzzed_data_provider.
ConsumeIntegral<int64_t>();
106 if (!IsValidAddition(script_num,
CScriptNum{random_integer})) {
111 script_num += random_integer;
114 const int64_t random_integer = fuzzed_data_provider.
ConsumeIntegral<int64_t>();
115 if (!IsValidSubtraction(script_num,
CScriptNum{random_integer})) {
120 script_num -= random_integer;
125 (void)script_num.
getint();
126 (void)script_num.
getvch();
std::vector< unsigned char > getvch() const
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
FUZZ_TARGET(scriptnum_ops)
CScriptNum ConsumeScriptNum(FuzzedDataProvider &fuzzed_data_provider) noexcept
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)