util: use explicit cast in MultiIntBitSet::Fill() #31431

pull vasild wants to merge 1 commits into bitcoin:master from vasild:fuzz_bitset_silence_warning changing 1 files +1 −1
  1. vasild commented at 4:01 pm on December 5, 2024: contributor

    The current code does not have a bug, but is implicitly casting -1 to 65535 and the sanitizer has no way to know whether we intend that or not.

    0FUZZ=bitset src/test/fuzz/fuzz /tmp/fuz
    1
    2error: implicit conversion from type 'int' of value -1 (32-bit, signed)
    3to type 'value_type' (aka 'unsigned short') changed the value to 65535
    4(16-bit, unsigned)
    5
    6Base64: Qv7bX/8=
    

    https://api.cirrus-ci.com/v1/task/5685829642747904/logs/ci.log

  2. util: use explicit cast in MultiIntBitSet::Fill()
    The current code does not have a bug, but is implicitly casting -1 to
    65535 and the sanitizer has no way to know whether we intend that or
    not.
    
    ```
    FUZZ=bitset src/test/fuzz/fuzz /tmp/fuz
    
    error: implicit conversion from type 'int' of value -1 (32-bit, signed)
    to type 'value_type' (aka 'unsigned short') changed the value to 65535
    (16-bit, unsigned)
    
    Base64: Qv7bX/8=
    ```
    edb41e4814
  3. DrahtBot commented at 4:01 pm on December 5, 2024: contributor

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

    Code Coverage & Benchmarks

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK sipa, maflcko, Empact, tdb3

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

  4. DrahtBot added the label Utils/log/libs on Dec 5, 2024
  5. vasild commented at 4:03 pm on December 5, 2024: contributor

    An alternative:

    16:53 < sipa> vasild: i would also be ok with a suppression, because this isn’t UB

    The typecast is used also elsewhere and is more robust wrt moving the code around.

  6. sipa commented at 4:03 pm on December 5, 2024: member
    ACK edb41e4814ccc2c06a5694b2d2632dbbd22bc0cf
  7. maflcko commented at 4:24 pm on December 5, 2024: member
    lgtm ACK edb41e4814ccc2c06a5694b2d2632dbbd22bc0cf
  8. Empact commented at 8:04 pm on December 5, 2024: contributor
    ACK edb41e4814ccc2c06a5694b2d2632dbbd22bc0cf
  9. tdb3 approved
  10. tdb3 commented at 2:40 am on December 6, 2024: contributor
    code review ACK edb41e4814ccc2c06a5694b2d2632dbbd22bc0cf
  11. fanquake merged this on Dec 6, 2024
  12. fanquake closed this on Dec 6, 2024

  13. vasild deleted the branch on Dec 6, 2024
  14. achow101 added the label Needs backport (28.x) on Dec 11, 2024
  15. achow101 referenced this in commit b8112cf422 on Dec 11, 2024
  16. fanquake removed the label Needs backport (28.x) on Dec 17, 2024
  17. fanquake commented at 11:15 am on December 17, 2024: member
    Backported in #31469.

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: 2024-12-22 00:12 UTC

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