feefrac test: avoid integer overflow (bugfix) #32240

pull sipa wants to merge 1 commits into bitcoin:master from sipa:202504_feefrac_fuzz_fix changing 1 files +3 −3
  1. sipa commented at 7:20 PM on April 8, 2025: member

    The feefrac_mul_div fuzz test fails after #30535 with the following (base64) input: Nb6Fc/97AACAAAD/ewAAgAAAAIAAAACAAAAAoA== (see https://cirrus-ci.com/task/5240029192126464?logs=ci#L3353).

    This is caused by an internal multiplication inside CFeeRate that just exceeds the limit of the int64_t type. Fix that by tightening the bounds slightly further.

  2. feefrac test: avoid integer overflow (bugfix) a2bc330da8
  3. DrahtBot commented at 7:21 PM on April 8, 2025: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32240.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK instagibbs, sr-gi, glozow

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. sipa commented at 7:21 PM on April 8, 2025: member

    cc @sr-gi

  5. sipa requested review from Copilot on Apr 8, 2025
  6. Copilot commented at 8:02 PM on April 8, 2025: none

    Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

    <details> <summary>Comments suppressed due to low confidence (1)</summary>

    src/test/fuzz/feefrac.cpp:223

    • The change from non-strict to strict inequalities correctly prevents borderline overflow conditions. Please verify that these adjustments do not inadvertently exclude valid cases that were intended to be processed.
    if (mul64 < std::numeric_limits<int64_t>::max() / 1000 &&
    

    </details>

  7. sipa commented at 8:02 PM on April 8, 2025: member

    Thanks, Copilot.

  8. laanwj added the label Tests on Apr 9, 2025
  9. instagibbs approved
  10. instagibbs commented at 3:14 PM on April 9, 2025: member

    ACK a2bc330da86b604069308f5237b77cfa77ed2b43

    Can confirm it was allowing one-too-large values for the computed CAmount, and that it fails on master.

  11. sr-gi commented at 3:21 PM on April 9, 2025: member

    utACK a2bc330da86b604069308f5237b77cfa77ed2b43

    Trying to reproduce on my local setup, which is proving challenging (macOS).

    I'll report later if I'm able to trigger it

  12. glozow commented at 6:26 PM on April 9, 2025: member

    ACK a2bc330da86b604069308f5237b77cfa77ed2b43, was able to reproduce + verify this fix

  13. glozow merged this on Apr 9, 2025
  14. glozow closed this on Apr 9, 2025

  15. sr-gi commented at 2:04 PM on April 10, 2025: member

    post-merge ACK, was able to reproduce locally and verify it doesn't crash anymore after the patch


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me