Error: Vector out of bounds in GetKey() #4962

pull ENikS wants to merge 1 commits into bitcoin:master from ENikS:get_key_vector_out_of_range changing 1 files +1 −1
  1. ENikS commented at 8:33 PM on September 22, 2014: contributor

    If 32 == vchData.size(): vchData[32] -> Out of bounds (Runtime error) vchData.begin() + 32 -> vchData.end() (Perfectly valid operation)

    If 33 == vchData.size(): - both notations work.

  2. Fixing out of bounds error in GetKey() 09e6bf0498
  3. BitcoinPullTester commented at 8:47 PM on September 22, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4962_09e6bf04981243e2facb27a9c945875d6910a55a/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  4. sipa commented at 8:48 PM on September 22, 2014: member

    utACK

  5. theuni commented at 11:19 PM on September 22, 2014: member

    Presumably this would turn what would've been an abort into a logical error. @sipa I guess the Check() inside of Set() is enough to make this fail gracefully if necessary?

    Might be worth checking vchData.size() before the Set() to make it more clear.

  6. laanwj commented at 7:17 AM on September 23, 2014: member

    utACK @theuni yes, the current code makes sure that this is always the case, but this would be a good place to add an assert that vchData.size>=32.

  7. laanwj referenced this in commit bfe527ea86 on Sep 23, 2014
  8. laanwj commented at 9:00 AM on September 23, 2014: member

    Merged via 6f3ae9b

  9. laanwj closed this on Sep 23, 2014

  10. ENikS deleted the branch on Sep 23, 2014
  11. MarcoFalke locked this on Sep 8, 2021

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-18 21:15 UTC

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