mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
codegen: clean any data from the input
This commit is contained in:
parent
7959ee49be
commit
547deec4be
@ -111,6 +111,9 @@ value is considered ``true`` by ``JUMPI`` instruction, we do not clean
|
||||
the boolean values before they are used as the condition for
|
||||
``JUMPI``.
|
||||
|
||||
In addition to the design principle above, the Solidity compiler
|
||||
cleans input data when it is loaded onto the stack.
|
||||
|
||||
Different types have different rules for cleaning up overflows:
|
||||
|
||||
+---------------+---------------+------------------+
|
||||
|
@ -925,8 +925,8 @@ unsigned CompilerUtils::loadFromMemoryHelper(Type const& _type, bool _fromCallda
|
||||
if (leftAligned)
|
||||
m_context << shiftFactor << Instruction::MUL;
|
||||
}
|
||||
if (_fromCalldata && _type.category() == Type::Category::Bool)
|
||||
m_context << Instruction::ISZERO << Instruction::ISZERO;
|
||||
if (_fromCalldata)
|
||||
convertType(_type, _type, true);
|
||||
|
||||
return numBytes;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(location_test)
|
||||
shared_ptr<string const> n = make_shared<string>("");
|
||||
AssemblyItems items = compileContract(sourceCode);
|
||||
vector<SourceLocation> locations =
|
||||
vector<SourceLocation>(16, SourceLocation(2, 75, n)) +
|
||||
vector<SourceLocation>(18, SourceLocation(2, 75, n)) +
|
||||
vector<SourceLocation>(27, SourceLocation(20, 72, n)) +
|
||||
vector<SourceLocation>{SourceLocation(42, 51, n), SourceLocation(65, 67, n)} +
|
||||
vector<SourceLocation>(2, SourceLocation(58, 67, n)) +
|
||||
|
Loading…
Reference in New Issue
Block a user