mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[SMTChecker] Add callstack model to overflow checks
This commit is contained in:
parent
939a178193
commit
a207d7f44c
@ -389,7 +389,8 @@ void SMTChecker::addOverflowTarget(
|
|||||||
std::move(_intType),
|
std::move(_intType),
|
||||||
std::move(_value),
|
std::move(_value),
|
||||||
currentPathConditions(),
|
currentPathConditions(),
|
||||||
_location
|
_location,
|
||||||
|
m_callStack
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,10 +398,12 @@ void SMTChecker::checkUnderOverflow()
|
|||||||
{
|
{
|
||||||
for (auto& target: m_overflowTargets)
|
for (auto& target: m_overflowTargets)
|
||||||
{
|
{
|
||||||
|
swap(m_callStack, target.callStack);
|
||||||
if (target.type != OverflowTarget::Type::Overflow)
|
if (target.type != OverflowTarget::Type::Overflow)
|
||||||
checkUnderflow(target);
|
checkUnderflow(target);
|
||||||
if (target.type != OverflowTarget::Type::Underflow)
|
if (target.type != OverflowTarget::Type::Underflow)
|
||||||
checkOverflow(target);
|
checkOverflow(target);
|
||||||
|
swap(m_callStack, target.callStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,13 +154,15 @@ private:
|
|||||||
smt::Expression value;
|
smt::Expression value;
|
||||||
smt::Expression path;
|
smt::Expression path;
|
||||||
langutil::SourceLocation const& location;
|
langutil::SourceLocation const& location;
|
||||||
|
std::vector<ASTNode const*> callStack;
|
||||||
|
|
||||||
OverflowTarget(Type _type, TypePointer _intType, smt::Expression _value, smt::Expression _path, langutil::SourceLocation const& _location):
|
OverflowTarget(Type _type, TypePointer _intType, smt::Expression _value, smt::Expression _path, langutil::SourceLocation const& _location, std::vector<ASTNode const*> _callStack):
|
||||||
type(_type),
|
type(_type),
|
||||||
intType(_intType),
|
intType(_intType),
|
||||||
value(_value),
|
value(_value),
|
||||||
path(_path),
|
path(_path),
|
||||||
location(_location)
|
location(_location),
|
||||||
|
callStack(move(_callStack))
|
||||||
{
|
{
|
||||||
solAssert(dynamic_cast<IntegerType const*>(intType.get()), "");
|
solAssert(dynamic_cast<IntegerType const*>(intType.get()), "");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user