Test adjustments and new tests.

This commit is contained in:
Daniel Kirchner 2020-10-06 21:16:06 +02:00
parent 56ba3f7c7e
commit 3a5cbf248e
8 changed files with 130 additions and 14 deletions

View File

@ -3,9 +3,9 @@ contract C {
function f(uint x, uint y) external payable returns (uint) { return 2; }
function call() public payable returns (uint v, uint x, uint y, uint z) {
v = this.f{value: 10}(2);
x = this.f{gas: 1000}(2, 3);
y = this.f{gas: 1000, value: 10}(2, 3);
z = this.f{gas: 1000}{value: 10}(2, 3);
x = this.f{gas: 100000}(2, 3);
y = this.f{gas: 100000, value: 10}(2, 3);
z = this.f{gas: 100000}{value: 10}(2, 3);
}
receive() external payable {}
}

View File

@ -14,7 +14,8 @@
// mstore(0x40, memoryguard(0x40))
// mstore(0x00, 0)
// sstore(0, mload(0x00))
// function h($hx) -> y
// { y := $hx }
// sstore(1, h(32))
// function h() -> y
// { y := mload(0x20) }
// mstore(0x20, 32)
// sstore(1, h())
// }

View File

@ -1,7 +1,7 @@
{
{
mstore(0x40, memoryguard(128))
sstore(0, f(0))
sstore(0, f(23))
}
function f(a1) -> v {
let a2 := calldataload(mul(2,4))
@ -46,9 +46,10 @@
// {
// {
// mstore(0x40, memoryguard(0xa0))
// sstore(0, f(0))
// mstore(0x80, 23)
// sstore(0, f())
// }
// function f(a1) -> v
// function f() -> v
// {
// let a2 := calldataload(mul(2, 4))
// let a3 := calldataload(mul(3, 4))
@ -66,7 +67,7 @@
// let a15 := calldataload(mul(15, 4))
// let a16 := calldataload(mul(16, 4))
// let a17 := calldataload(mul(17, 4))
// sstore(0, a1)
// sstore(0, mload(0x80))
// sstore(mul(17, 4), a17)
// sstore(mul(16, 4), a16)
// sstore(mul(15, 4), a15)
@ -83,6 +84,6 @@
// sstore(mul(4, 4), a4)
// sstore(mul(3, 4), a3)
// sstore(mul(2, 4), a2)
// sstore(mul(1, 4), a1)
// sstore(mul(1, 4), mload(0x80))
// }
// }

View File

@ -0,0 +1,25 @@
{
function f(a1, a2, a3, a4, a5, a6, a7, a8) -> a9, a10, a11, a12, a13, a14, a15, a16 {
}
function g() -> a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 {}
function h() -> a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16 {}
pop(memoryguard(0))
let b9, b10, b11, b12, b13, b14, b15, b16 := f(1, 2, 3, 4, 5, 6, 7, 8)
let c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16 := g()
let d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16 := h()
}
// ----
// step: stackLimitEvader
//
// {
// function f(a1, a2, a3, a4, a5, a6, a7, a8) -> a9, a10, a11, a12, a13, a14, a15, a16
// { }
// function g() -> a1_1, a2_2, a3_3, a4_4, a5_5, a6_6, a7_7, a8_8, a9_9, a10_10, a11_11, a12_12, a13_13, a14_14, a15_15, a16_16
// { }
// function h() -> a1_17, a2_18, a3_19, a4_20, a5_21, a6_22, a7_23, a8_24, a9_25, a10_26, a11_27, a12_28, a13_29, a14_30, a15_31, a16_32
// { }
// pop(memoryguard(0x00))
// let b9, b10, b11, b12, b13, b14, b15, b16 := f(1, 2, 3, 4, 5, 6, 7, 8)
// let c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16 := g()
// let d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16 := h()
// }

View File

@ -52,10 +52,28 @@
// {
// {
// mstore(0x40, memoryguard(0xa0))
// sstore(g(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), f())
// let _3 := f()
// let _4 := 16
// let _5 := 15
// let _6 := 14
// let _7 := 13
// let _8 := 12
// let _9 := 11
// let _10 := 10
// let _11 := 9
// let _12 := 8
// let _13 := 7
// let _14 := 6
// let _15 := 5
// let _16 := 4
// let _17 := 3
// let _18 := 2
// let _19 := 1
// mstore(0x80, _4)
// sstore(g(_19, _18, _17, _16, _15, _14, _13, _12, _11, _10, _9, _8, _7, _6, _5), _3)
// }
// function g(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16) -> v
// { v := b16 }
// function g(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15) -> v
// { v := mload(0x80) }
// function f() -> v_1
// {
// mstore(0x80, calldataload(mul(1, 4)))

View File

@ -0,0 +1,24 @@
{
function f(a1, a2, a3, a4, a5, a6, a7, a8) -> a9, a10, a11, a12, a13, a14, a15, a16, a17 {
}
pop(memoryguard(0))
let b9, b10, b11, b12, b13, b14, b15, b16, b17 := f(1, 2, 3, 4, 5, 6, 7, 8)
}
// ----
// step: stackLimitEvader
//
// {
// function f(a1, a2, a3, a4, a5, a6, a7) -> a9, a10, a11, a12, a13, a14, a15, a16, a17
// { }
// pop(memoryguard(0x20))
// let _2 := 8
// let _3 := 7
// let _4 := 6
// let _5 := 5
// let _6 := 4
// let _7 := 3
// let _8 := 2
// let _9 := 1
// mstore(0x00, _2)
// let b9, b10, b11, b12, b13, b14, b15, b16, b17 := f(_9, _8, _7, _6, _5, _4, _3)
// }

View File

@ -0,0 +1,32 @@
{
function f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) {}
pop(memoryguard(0))
f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)
}
// ----
// step: stackLimitEvader
//
// {
// function f(a1, a2, a3, a4, a5, a6, a7, a9, a10, a11, a12, a13, a14, a15, a16, a17)
// { }
// pop(memoryguard(0x20))
// let _2 := 17
// let _3 := 16
// let _4 := 15
// let _5 := 14
// let _6 := 13
// let _7 := 12
// let _8 := 11
// let _9 := 10
// let _10 := 9
// let _11 := 8
// let _12 := 7
// let _13 := 6
// let _14 := 5
// let _15 := 4
// let _16 := 3
// let _17 := 2
// let _18 := 1
// mstore(0x00, _11)
// f(_18, _17, _16, _15, _14, _13, _12, _10, _9, _8, _7, _6, _5, _4, _3, _2)
// }

View File

@ -0,0 +1,15 @@
{
function g() -> a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17 {}
pop(memoryguard(0))
let b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17 := g()
}
// ----
// step: stackLimitEvader
//
// {
// function g() -> a1, a2, a3, a4, a5, a6, a7, a9, a10, a11, a12, a13, a14, a15, a16, a17
// { mstore(0x00, 0) }
// pop(memoryguard(0x20))
// let b1, b2, b3, b4, b5, b6, b7, b9, b10, b11, b12, b13, b14, b15, b16, b17 := g()
// let b8 := mload(0x00)
// }