mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6585 from ethereum/fixInvalidFunctionTags
Fix invalid function tags
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
contract C {
|
||||
|
||||
function() internal storedFn;
|
||||
|
||||
bool flag;
|
||||
|
||||
constructor() public {
|
||||
if (!flag) {
|
||||
flag = true;
|
||||
function() internal invalid;
|
||||
storedFn = invalid;
|
||||
invalid();
|
||||
}
|
||||
}
|
||||
function f() public pure {}
|
||||
}
|
||||
contract Test {
|
||||
function f() public {
|
||||
new C();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f() -> FAILURE
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
contract C {
|
||||
|
||||
function() internal storedFn;
|
||||
|
||||
bool flag;
|
||||
|
||||
constructor() public {
|
||||
if (!flag) {
|
||||
flag = true;
|
||||
function() internal invalid;
|
||||
storedFn = invalid;
|
||||
storedFn();
|
||||
}
|
||||
}
|
||||
function f() public pure {}
|
||||
}
|
||||
contract Test {
|
||||
function f() public {
|
||||
new C();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f() -> FAILURE
|
||||
@@ -0,0 +1,39 @@
|
||||
pragma solidity ^0.5.7;
|
||||
|
||||
contract InvalidTest {
|
||||
|
||||
function() internal storedFn;
|
||||
uint public x;
|
||||
|
||||
constructor() public {
|
||||
uint _y1;
|
||||
uint _y2;
|
||||
uint _y3;
|
||||
uint _y4;
|
||||
uint _y5;
|
||||
uint _y6;
|
||||
uint _y7;
|
||||
uint _y8;
|
||||
uint _y9;
|
||||
uint _y10;
|
||||
uint _y11;
|
||||
uint _y12;
|
||||
uint _y13;
|
||||
uint _y14;
|
||||
|
||||
|
||||
function() internal invalid;
|
||||
storedFn = invalid;
|
||||
}
|
||||
|
||||
function run() public {
|
||||
// this did not always cause revert in the past
|
||||
storedFn();
|
||||
}
|
||||
|
||||
function z() public {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// run() -> FAILURE
|
||||
@@ -0,0 +1,19 @@
|
||||
contract InvalidTest {
|
||||
|
||||
function() internal storedFn;
|
||||
|
||||
bool flag;
|
||||
|
||||
constructor() public {
|
||||
function() internal invalid;
|
||||
storedFn = invalid;
|
||||
}
|
||||
function f() public returns (uint) {
|
||||
if (flag) return 2;
|
||||
flag = true;
|
||||
storedFn();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// f() -> FAILURE
|
||||
// f() -> FAILURE
|
||||
Reference in New Issue
Block a user