mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Defensively pad memory for `type(C).name
` to multiples of 32.
This commit is contained in:
parent
2da906d901
commit
2e7794d8a6
@ -7,6 +7,7 @@ Compiler Features:
|
||||
|
||||
|
||||
Bugfixes:
|
||||
* Code Generator: Defensively pad memory for ``type(Contract).name`` to multiples of 32.
|
||||
|
||||
|
||||
Build System:
|
||||
|
@ -1394,7 +1394,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
|
||||
{
|
||||
TypePointer arg = dynamic_cast<MagicType const&>(*_memberAccess.expression().annotation().type).typeArgument();
|
||||
ContractDefinition const& contract = dynamic_cast<ContractType const&>(*arg).contractDefinition();
|
||||
utils().allocateMemory(contract.name().length() + 32);
|
||||
utils().allocateMemory(((contract.name().length() + 31) / 32) * 32 + 32);
|
||||
// store string length
|
||||
m_context << u256(contract.name().length()) << Instruction::DUP2 << Instruction::MSTORE;
|
||||
// adjust pointer
|
||||
|
Loading…
Reference in New Issue
Block a user