rpc: Clarify pblock assumption via an assertion #10638

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:nnonce changing 1 files +1 −0
  1. practicalswift commented at 9:26 PM on June 20, 2017: contributor

    pblock->nNonce = 0 will result in a nullptr dereference if the added assertion does not hold true.

    pblock != nullptr is not obvious from reading the code - hence the need for stating this assumption explicitly via an assertion. This has the added benefit getting rid of the following clang-tidy warning:

    rpc/mining.cpp:560:20: note: Access to field 'nNonce' results in
      a dereference of a null pointer (loaded from variable 'pblock')
        pblock->nNonce = 0;
    
  2. practicalswift cross-referenced this on Jun 20, 2017 from issue [rpc]Avoid possibility of NULL pointer dereference in getblockchaininfo(...) by pavlosantoniou
  3. fanquake added the label RPC/REST/ZMQ on Jun 20, 2017
  4. practicalswift force-pushed on Aug 9, 2017
  5. practicalswift commented at 12:46 PM on January 31, 2018: contributor

    Anyone willing to review? :-)

  6. Clarify pblock assumption via an assertion
    pblock->nNonce = 0 will result in a nullptr dereference if the
    added assertion does not hold true.
    
    pblock != nullptr is not obvious from reading the code - hence
    the need for stating this assumption explicitly via an assertion.
    This has the added benefit getting rid of the following clang-tidy
    warning:
    
    rpc/mining.cpp:560:20: note: Access to field 'nNonce' results in
      a dereference of a null pointer (loaded from variable 'pblock')
        pblock->nNonce = 0;
    4ec3d98730
  7. practicalswift force-pushed on Mar 9, 2018
  8. practicalswift renamed this:
    [rpc] Clarify pblock assumption via an assertion
    rpc: Clarify pblock assumption via an assertion
    on Mar 19, 2018
  9. practicalswift commented at 3:09 PM on March 27, 2018: contributor

    Seems to be consensus NACK on this one. Closing :-)

  10. practicalswift closed this on Mar 27, 2018

  11. practicalswift deleted the branch on Apr 10, 2021
  12. bitcoin locked this on Aug 18, 2022

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-05-20 06:55 UTC