RPCConsole: Throw when overflowing size_t type for array indices #446

pull MarcoFalke wants to merge 1 commits into bitcoin-core:master from MarcoFalke:2110-qtRpcCons changing 1 files +5 −4
  1. MarcoFalke commented at 2:01 pm on October 5, 2021: contributor

    To test:

    -> getblock(getbestblockhash(), 1)[tx][22222222222222222222222222222]

    Before:

    <- 868693731dea69a197c13c2cfaa41c9f78fcdeb8ab8e9f8cdf2c9025147ee7d1 (hash of the coinbase tx)

    After:

    <- Error: Invalid result query

  2. RPCConsole: Throw when overflowing size_t type for array indices faa5e171e6
  3. jarolrod added the label Bug on Oct 5, 2021
  4. jarolrod commented at 7:31 pm on October 5, 2021: member
    concept ack
  5. jarolrod commented at 3:20 am on October 6, 2021: member

    ACK faa5e171e6bdb8f3b4027a3f06497f0de5abf766

    tested and code review ack. This is a nice catch!

    on master:

    0<-  getblock(getbestblockhash(), 1)[tx][22222222222222222222222222222]
    1->  e3038545d5b68dc61a282f15eb8e3ffbfb50c3f9955380a1fde3c1c858414d38
    

    on PR branch:

    0<-  getblock(getbestblockhash(), 1)[tx][22222222222222222222222222222]
    1->  Error: Invalid result query
    
  6. shaavan approved
  7. shaavan commented at 2:34 pm on October 6, 2021: contributor

    ACK faa5e17 Tested on Ubuntu 20.04

    This PR allows displaying runtime error for inputs greater than the limit of size_t type.

    This is done by using the ToIntegral<size_t> function, which will check the size of the input argument. Earlier, the logic was to check if each character of the input argument is a digit or not without considering the overall length of the input argument.

    This is undoubtedly an improvement over the current Master, and I agree with this PR. I am adding the screenshot of input and outputs that I used to test this PR on the GUI console. The test was done on the Signet network.

    Screenshots:

    Master (outputs null, without errors) PR (output error)
    Screenshot from 2021-10-06 19-51-35 Screenshot from 2021-10-06 19-45-25
  8. MarcoFalke merged this on Oct 6, 2021
  9. MarcoFalke closed this on Oct 6, 2021

  10. MarcoFalke deleted the branch on Oct 6, 2021
  11. sidhujag referenced this in commit 5c43192451 on Oct 6, 2021
  12. bitcoin-core locked this on Oct 6, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-23 00:20 UTC

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