From d8a18ef34f9e721bbf891838335cecfa2e48e214 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 8 Sep 2017 00:02:24 +0200 Subject: [PATCH 1/2] fix incorrect bounds check to wit.vtxinwit access in ContextualCheckBlock --- src/validation.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index 5a3e98c829..a54a4d9820 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3888,7 +3888,9 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const Co int commitpos = GetWitnessCommitmentIndex(block); if (commitpos != -1) { uint256 hashWitness = BlockWitnessMerkleRoot(block); - if ((block.vtx[0]->wit.vtxinwit.size() > 0 &&block.vtx[0]->wit.vtxinwit[0].scriptWitness.stack.size() != 1) || block.vtx[0]->wit.vtxinwit[0].scriptWitness.stack[0].size() != 32) { + if (block.vtx[0]->wit.vtxinwit.empty() + || block.vtx[0]->wit.vtxinwit[0].scriptWitness.stack.size() != 1 + || block.vtx[0]->wit.vtxinwit[0].scriptWitness.stack[0].size() != 32) { return state.DoS(100, false, REJECT_INVALID, "bad-witness-nonce-size", true, strprintf("%s : invalid witness nonce size", __func__)); } CHash256().Write(hashWitness.begin(), 32).Write(&block.vtx[0]->wit.vtxinwit[0].scriptWitness.stack[0][0], 32).Finalize(hashWitness.begin()); From feb64d9ca6770744656abdf8c9a9fdaf27648c78 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 8 Sep 2017 20:31:13 +0200 Subject: [PATCH 2/2] cherry-pick of aa2e0f09ec94dd0908f792ebc2249859ad174586 from bitcoin repository --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 08a34e673a..879909033f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,7 @@ env: before_install: - export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g") + - export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/pyenv/d' | tr "\n" ":" | sed "s|::|:|g") install: - if [ -n "$PPA" ]; then travis_retry sudo add-apt-repository "$PPA" -y; fi - if [ -n "$DPKG_ADD_ARCH" ]; then sudo dpkg --add-architecture "$DPKG_ADD_ARCH" ; fi