What changed, and why it matters
This commit only cleans up compiler warnings in test/fuzzing code. It changes some integer variable types from signed to unsigned and removes an unused variable. There is no change to the live Monero node or wallet code that users run, and nothing here affects real funds, privacy, or network security.
No security action needed. Treat as routine code-quality cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies two files under tests/fuzz/fuzz_rpc/. fuzz_rpc.cpp switches several loop counters, selectors, and fuzz-target indices from int to unsigned to silence signed/unsigned comparison warnings and match std::vector::size_type. initialisation.cpp removes the unused bool added_txs and its single assignment. These are cosmetic/test-harness-only changes; no production code paths are altered.
Changed components
tests/fuzz/fuzz_rpc/fuzz_rpc.cpptests/fuzz/fuzz_rpc/initialisation.cppInspect captured patch +8 / −11
diff --git a/tests/fuzz/fuzz_rpc/fuzz_rpc.cpp b/tests/fuzz/fuzz_rpc/fuzz_rpc.cpp
index ba19692..92ffe99 100644
--- a/tests/fuzz/fuzz_rpc/fuzz_rpc.cpp
+++ b/tests/fuzz/fuzz_rpc/fuzz_rpc.cpp
@@ -32,26 +32,26 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
FuzzedDataProvider provider(data, size);
// Randomly choose multiple fuzz_targets to fuzz
- int rpc_messages_to_send = provider.ConsumeIntegralInRange<int>(1, 16);
- std::vector<int> selectors;
+ unsigned rpc_messages_to_send = provider.ConsumeIntegralInRange<unsigned>(1, 16);
+ std::vector<unsigned> selectors;
if (is_safe_mode) {
selectors.reserve(rpc_messages_to_send);
} else {
selectors.reserve(rpc_messages_to_send + priority_fuzz_targets.size());
- for (int i = 0; i < priority_fuzz_targets.size(); ++i) {
+ for (unsigned i = 0; i < priority_fuzz_targets.size(); ++i) {
selectors.push_back(i);
}
// Randomly shuffle the selectors for priority fuzz targets
- for (int i = 0; i < priority_fuzz_targets.size(); i++) {
- int target = provider.ConsumeIntegralInRange<int>(0, priority_fuzz_targets.size() - 1);
+ for (unsigned i = 0; i < priority_fuzz_targets.size(); i++) {
+ unsigned target = provider.ConsumeIntegralInRange<unsigned>(0, priority_fuzz_targets.size() - 1);
std::swap(selectors[i], selectors[target]);
}
}
// Randomly select rpc functions to call
- for (int i = 0; i < rpc_messages_to_send && provider.remaining_bytes() >= 2; ++i) {
- int selector = provider.ConsumeIntegralInRange<int>(0, fuzz_targets.size() - 1);
+ for (unsigned i = 0; i < rpc_messages_to_send && provider.remaining_bytes() >= 2; ++i) {
+ unsigned selector = provider.ConsumeIntegralInRange<unsigned>(0, fuzz_targets.size() - 1);
selectors.push_back(selector);
}
@@ -70,7 +70,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Disable bootstrap daemon
disable_bootstrap_daemon(*rpc_handler->rpc);
- for (int selector : selectors) {
+ for (unsigned selector : selectors) {
try {
// Fuzz the target function
fuzz_targets[selector](*rpc_handler->rpc, provider);
diff --git a/tests/fuzz/fuzz_rpc/initialisation.cpp b/tests/fuzz/fuzz_rpc/initialisation.cpp
index 6c2b06e..15eca33 100644
--- a/tests/fuzz/fuzz_rpc/initialisation.cpp
+++ b/tests/fuzz/fuzz_rpc/initialisation.cpp
@@ -338,13 +338,10 @@ bool generate_random_blocks(cryptonote::core& core, FuzzedDataProvider& provider
}
}
- bool added_txs = false;
for (const auto& tx_blob : cached_txs) {
cryptonote::tx_verification_context tvc;
bool accepted = core.handle_incoming_tx(tx_blob, tvc, cryptonote::relay_method::block, true);
if (accepted || tvc.m_added_to_pool) {
- added_txs = true;
-
// Store legit hashes
cryptonote::transaction tx;
if (cryptonote::parse_and_validate_tx_from_blob(tx_blob, tx)) {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.