Fixing run time exception: reference into empty vector #4968

pull ENikS wants to merge 1 commits into bitcoin:master from ENikS:vector_subscript_out_of_range changing 2 files +7 −7
  1. ENikS commented at 5:35 PM on September 23, 2014: contributor

    Replacing it with more predictable behavior.

  2. Fixing reference into empty vector run time exception. Replacing it with more predictable behavior. 744f7c6522
  3. BitcoinPullTester commented at 5:49 PM on September 23, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4968_744f7c6522c23e635a32ba5c327a0b62d49ef6ee/ 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 5:51 PM on September 23, 2014: member

    ACK

  5. in src/test/base58_tests.cpp:None in 744f7c6522
      39 | @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(base58_EncodeBase58)
      40 |          std::vector<unsigned char> sourcedata = ParseHex(test[0].get_str());
      41 |          std::string base58string = test[1].get_str();
      42 |          BOOST_CHECK_MESSAGE(
      43 | -                    EncodeBase58(&sourcedata[0], &sourcedata[sourcedata.size()]) == base58string,
      44 | +                    EncodeBase58(begin_ptr(sourcedata), begin_ptr(sourcedata) + sourcedata.size()) == base58string,
    


    laanwj commented at 9:37 AM on September 25, 2014:

    Nit: begin_ptr(sourcedata) + sourcedata.size() could be end_ptr(sourcedata)


    ENikS commented at 2:56 PM on September 25, 2014:

    One of these 'DA' moments. Should have thought that if there is a begin_ptr, there should be end_ptr as well.

    Perhaps a pointer to useful macros should go to a coding guidelines as well?


    laanwj commented at 3:25 PM on September 25, 2014:

    Indeed, that could be useful to add.


    ENikS commented at 3:35 PM on September 25, 2014:

    Not to split hairs but would it be a bit more appropriate to use

    &v.front()
    instead of
    &v[0]
    

    Not that it matters, but since we are so big on style...


    laanwj commented at 8:19 AM on September 26, 2014:

    Believe me, we're not really big on style :) We're somewhat insistent on not changing files to a meltingpot of different code styles, but apart from that, I always prefer pull requests that actually fix an issue (as you've been doing).

  6. laanwj referenced this in commit b50e5fe099 on Sep 25, 2014
  7. laanwj commented at 10:47 AM on September 25, 2014: member

    Merged via b50e5fe (with nit fix)

  8. laanwj closed this on Sep 25, 2014

  9. in src/script/interpreter.cpp:None in 744f7c6522
     653 | +                        CHash256().Write(begin_ptr(vch), vch.size()).Finalize(begin_ptr(vchHash));
     654 |                      popstack(stack);
     655 |                      stack.push_back(vchHash);
     656 |                  }
     657 | -                break;
     658 | +                break;                                   
    


    Diapolo commented at 11:15 AM on September 25, 2014:

    @laanwj Why are whitespace changes acceptable here?


    laanwj commented at 11:19 AM on September 25, 2014:

    They are not; but I must have missed this, and it seems accidental anyway.

  10. ENikS deleted the branch on Sep 25, 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 18:15 UTC

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