Browse Source

Add test for global stack underflow.

cl-refactor
Paweł Bylica 10 years ago
parent
commit
1de60c02e6
  1. 3
      evmjit/libevmjit/Stack.cpp
  2. 31
      test/libevm/VMTestsFiller/vmIOandFlowOperationsTestFiller.json

3
evmjit/libevmjit/Stack.cpp

@ -71,8 +71,7 @@ void Stack::set(size_t _index, llvm::Value* _value)
void Stack::pop(size_t _count)
{
// FIXME: Pop does not check for stack underflow but looks like not needed
// We should place stack.require() check and begining of every BB
// TODO: We should place stack.require() check and begining of every BB
m_stack.pop(m_builder.getInt64(_count));
}

31
test/libevm/VMTestsFiller/vmIOandFlowOperationsTestFiller.json

@ -2304,6 +2304,37 @@
}
},
"DynamicJump_valueUnderflow": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "100000000000000000000000",
"nonce" : "0",
"code" : "(asm 1 2 3 CALLVALUE JUMP
JUMPDEST POP POP 0 MSTORE MSIZE 0 RETURN
JUMPDEST POP 0 MSTORE MSIZE 0 RETURN
JUMPDEST POP POP POP 0 MSTORE MSIZE 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "27",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "100000"
}
},
"BlockNumberDynamicJumpiAfterStop": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",

Loading…
Cancel
Save