mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Cause failing assertion for invalid u256 to bool conversion.
This commit is contained in:
parent
db33ff6408
commit
2bcdb24ebe
@ -266,10 +266,15 @@ EVMDialectTyped::EVMDialectTyped(langutil::EVMVersion _evmVersion, bool _objectA
|
|||||||
BuiltinContext&,
|
BuiltinContext&,
|
||||||
std::function<void()> _visitArguments
|
std::function<void()> _visitArguments
|
||||||
) {
|
) {
|
||||||
// TODO Should a value larger than 1 be invalid?
|
// A value larger than 1 causes an invalid instruction.
|
||||||
_visitArguments();
|
_visitArguments();
|
||||||
_assembly.appendInstruction(evmasm::Instruction::ISZERO);
|
_assembly.appendConstant(2);
|
||||||
_assembly.appendInstruction(evmasm::Instruction::ISZERO);
|
_assembly.appendInstruction(evmasm::Instruction::DUP2);
|
||||||
|
_assembly.appendInstruction(evmasm::Instruction::LT);
|
||||||
|
AbstractAssembly::LabelID inRange = _assembly.newLabelId();
|
||||||
|
_assembly.appendJumpToIf(inRange);
|
||||||
|
_assembly.appendInstruction(evmasm::Instruction::INVALID);
|
||||||
|
_assembly.appendLabel(inRange);
|
||||||
}));
|
}));
|
||||||
m_functions["u256_to_bool"_yulstring].returns = {"bool"_yulstring};
|
m_functions["u256_to_bool"_yulstring].returns = {"bool"_yulstring};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user