mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Merge #255: fix incorrect bounds check to wit.vtxinwit access in ContextualCheckBlock
feb64d9cherry-pick ofaa2e0f09ecfrom bitcoin repository (Arvid Norberg)d8a18effix incorrect bounds check to wit.vtxinwit access in ContextualCheckBlock (Arvid Norberg)
This commit is contained in:
commit
1e1a2e580e
2 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue