mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Raise error on oversized number literals in assembly
This commit is contained in:
parent
d01786f0aa
commit
ae02bb5aad
@ -6,6 +6,7 @@ Features:
|
||||
* Type Checker: Disallow uninitialized storage pointers as experimental 0.5.0 feature.
|
||||
|
||||
Bugfixes:
|
||||
* Assembly: Raise error on oversized number literals in assembly.
|
||||
* JSON-AST: Add "documentation" property to function, event and modifier definition.
|
||||
* Resolver: Properly determine shadowing for imports with aliases.
|
||||
* Standalone Assembly: Do not ignore input after closing brace of top level block.
|
||||
|
@ -82,6 +82,14 @@ bool AsmAnalyzer::operator()(assembly::Literal const& _literal)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
else if (_literal.kind == assembly::LiteralKind::Number && bigint(_literal.value) > u256(-1))
|
||||
{
|
||||
m_errorReporter.typeError(
|
||||
_literal.location,
|
||||
"Number literal too large (> 256 bits)"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
m_info.stackHeightInfo[&_literal] = m_stackHeight;
|
||||
return true;
|
||||
}
|
||||
|
@ -228,6 +228,7 @@ BOOST_AUTO_TEST_CASE(number_literals)
|
||||
CHECK_ERROR("{ let x:u256 := .1:u256 }", ParserError, "Invalid number literal.");
|
||||
CHECK_ERROR("{ let x:u256 := 1e5:u256 }", ParserError, "Invalid number literal.");
|
||||
CHECK_ERROR("{ let x:u256 := 67.235:u256 }", ParserError, "Invalid number literal.");
|
||||
CHECK_ERROR("{ let x:u256 := 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff:u256 }", TypeError, "Number literal too large (> 256 bits)");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(builtin_types)
|
||||
|
@ -390,6 +390,7 @@ BOOST_AUTO_TEST_CASE(number_literals)
|
||||
CHECK_PARSE_ERROR("{ let x := .1 }", ParserError, "Invalid number literal.");
|
||||
CHECK_PARSE_ERROR("{ let x := 1e5 }", ParserError, "Invalid number literal.");
|
||||
CHECK_PARSE_ERROR("{ let x := 67.235 }", ParserError, "Invalid number literal.");
|
||||
CHECK_STRICT_ERROR("{ let x := 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff }", TypeError, "Number literal too large (> 256 bits)");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_definitions)
|
||||
|
Loading…
Reference in New Issue
Block a user