diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-01-24 17:30:03 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:56 +0800 |
commit | 72224d6ebc1763ee3787164fca00fe6d3ae501d6 (patch) | |
tree | cf536e3a7602bad487f980260871ceabf163e8f7 /rlp | |
parent | 87db7f44d06ff4610b7a7a0b3bc845b8d8e342d0 (diff) | |
download | go-tangerine-72224d6ebc1763ee3787164fca00fe6d3ae501d6.tar go-tangerine-72224d6ebc1763ee3787164fca00fe6d3ae501d6.tar.gz go-tangerine-72224d6ebc1763ee3787164fca00fe6d3ae501d6.tar.bz2 go-tangerine-72224d6ebc1763ee3787164fca00fe6d3ae501d6.tar.lz go-tangerine-72224d6ebc1763ee3787164fca00fe6d3ae501d6.tar.xz go-tangerine-72224d6ebc1763ee3787164fca00fe6d3ae501d6.tar.zst go-tangerine-72224d6ebc1763ee3787164fca00fe6d3ae501d6.zip |
core: vm: modify randomness calculation algorithm (#173)
The original algorithm used for calculating algorithm is vulnerable to
cross context re-entry attack. Example as follows:
contract B {
event Value(uint256 value);
uint256 public value;
function call() public {
value = rand;
emit Value(value);
}
}
contract A {
function randTwice(address bAddr) public {
B b = B(bAddr);
b.call.gas(100000)();
b.call.gas(100000)();
}
}
The two `b.call` will result in the same randomness value. This commit
fix the issue by recording a called index used to store how many times
opRand is called, and use it as argument to the Keccak call.
Diffstat (limited to 'rlp')
0 files changed, 0 insertions, 0 deletions