mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Do not trust code of external functions
This commit is contained in:
parent
56e7d43384
commit
5517e817d5
@ -10,7 +10,7 @@ Compiler Features:
|
|||||||
* Commandline Interface: Prevent some incompatible commandline options from being used together.
|
* Commandline Interface: Prevent some incompatible commandline options from being used together.
|
||||||
* NatSpec: Support NatSpec comments on events.
|
* NatSpec: Support NatSpec comments on events.
|
||||||
* Yul Optimizer: Store knowledge about storage / memory after ``a := sload(x)`` / ``a := mload(x)``.
|
* Yul Optimizer: Store knowledge about storage / memory after ``a := sload(x)`` / ``a := mload(x)``.
|
||||||
* SMTChecker: Support to external calls to unknown code and to known view/pure functions.
|
* SMTChecker: Support external calls to unknown code.
|
||||||
|
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
@ -592,6 +592,9 @@ void CHC::externalFunctionCall(FunctionCall const& _funCall)
|
|||||||
if (!function)
|
if (!function)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
for (auto var: function->returnParameters())
|
||||||
|
m_context.variable(*var)->increaseIndex();
|
||||||
|
|
||||||
auto preCallState = currentStateVariables();
|
auto preCallState = currentStateVariables();
|
||||||
bool usesStaticCall = kind == FunctionType::Kind::BareStaticCall ||
|
bool usesStaticCall = kind == FunctionType::Kind::BareStaticCall ||
|
||||||
function->stateMutability() == StateMutability::Pure ||
|
function->stateMutability() == StateMutability::Pure ||
|
||||||
@ -602,7 +605,6 @@ void CHC::externalFunctionCall(FunctionCall const& _funCall)
|
|||||||
|
|
||||||
auto nondet = (*m_nondetInterfaces.at(m_currentContract))(preCallState + currentStateVariables());
|
auto nondet = (*m_nondetInterfaces.at(m_currentContract))(preCallState + currentStateVariables());
|
||||||
m_context.addAssertion(nondet);
|
m_context.addAssertion(nondet);
|
||||||
m_context.addAssertion(predicate(_funCall));
|
|
||||||
|
|
||||||
m_context.addAssertion(m_error.currentValue() == 0);
|
m_context.addAssertion(m_error.currentValue() == 0);
|
||||||
}
|
}
|
||||||
|
@ -27,3 +27,5 @@ contract C {
|
|||||||
assert(sig_1 == sig_2);
|
assert(sig_1 == sig_2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ----
|
||||||
|
// Warning 4661: (438-460): Assertion violation happens here
|
||||||
|
@ -16,3 +16,4 @@ contract D
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
|
// Warning 4661: (191-206): Assertion violation happens here
|
||||||
|
Loading…
Reference in New Issue
Block a user