test: Prevent UB in minisketch_tests.cpp #26272

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:221006-sketch changing 1 files +1 −1
  1. hebasto commented at 11:52 am on October 6, 2022: member

    std::optional::operator*, which follows after the changed line, can cause UB.

    This PR addresses #26262 (comment)

  2. test: Prevent UB in `minisketch_tests.cpp` 97007e2b9b
  3. DrahtBot added the label Tests on Oct 6, 2022
  4. stickies-v approved
  5. stickies-v commented at 1:52 pm on October 6, 2022: contributor

    ACK 97007e2b9b7a578315df2b1549cd6075130e8f05

    dec should never be dereferenced if has_value() is not true.

  6. maflcko commented at 2:00 pm on October 6, 2022: member

    BOOST_CHECK should still print the failure, making the UB more obvious, but this can’t hurt.

    LGTM

  7. maflcko merged this on Oct 6, 2022
  8. maflcko closed this on Oct 6, 2022

  9. sidhujag referenced this in commit 7e057fbc1e on Oct 6, 2022
  10. hebasto deleted the branch on Oct 6, 2022
  11. bitcoin locked this on Oct 6, 2023

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-07-05 22:12 UTC

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