Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#27917: fuzz: Fix implicit-integer-sign-change i…
Browse files Browse the repository at this point in the history
…n wallet/fees fuzz target

faa05d1 fuzz: Fix implicit-integer-sign-change in wallet/fees fuzz target (MarcoFalke)

Pull request description:

  This fixes a bug in the fuzz target.

  ```
  echo 'OiAAAPr//wAAAAAAAAA=' | base64  --decode > /tmp/a
  UBSAN_OPTIONS="suppressions=$(pwd)/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1" FUZZ=wallet_fees ./src/test/fuzz/fuzz  /tmp/a
  ```

  ```
  wallet/fees.cpp:58:58: runtime error: implicit conversion from type 'unsigned int' of value 4294574080 (32-bit, unsigned) to type 'int' changed the value to -393216 (32-bit, signed)
      #0 0x5625ef46a094 in wallet::GetMinimumFeeRate(wallet::CWallet const&, wallet::CCoinControl const&, FeeCalculation*) src/wallet/fees.cpp:58:58
      #1 0x5625eedd467f in wallet::(anonymous namespace)::wallet_fees_fuzz_target(Span<unsigned char const>) src/wallet/test/fuzz/fees.cpp:64:11
  ...

  SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change wallet/fees.cpp:58:58 in

ACKs for top commit:
  dergoegge:
    tACK faa05d1
  brunoerg:
    ACK faa05d1

Tree-SHA512: 66a4020d6a4153a92c7023e9f94ec6279862566db7236ce3cf6951b7fbee616dc88a56fe9502de4099d74f9840439b20a984b0733fb432e43129e774bcc2a6e6
  • Loading branch information
fanquake committed Jun 20, 2023
2 parents f80db62 + faa05d1 commit c2316b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wallet/test/fuzz/fees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ FUZZ_TARGET_INIT(wallet_fees, initialize_setup)
coin_control.m_feerate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /*max=*/COIN)};
}
if (fuzzed_data_provider.ConsumeBool()) {
coin_control.m_confirm_target = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
coin_control.m_confirm_target = fuzzed_data_provider.ConsumeIntegralInRange<unsigned int>(0, 999'000);
}

FeeCalculation fee_calculation;
Expand Down

0 comments on commit c2316b1

Please sign in to comment.