Defensively pad memory for `type(C).name` to multiples of 32.

This commit is contained in:
chriseth
2019-03-13 18:51:32 +01:00
parent 2da906d901
commit 2e7794d8a6
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -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