From 364b4dea6269debefc0a7eaedbec4a60fbf0e74d Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 Sep 2017 18:25:36 +0200 Subject: [PATCH] Add some asserts about calldata encoded size. --- libsolidity/codegen/ArrayUtils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsolidity/codegen/ArrayUtils.cpp b/libsolidity/codegen/ArrayUtils.cpp index e17188c26..ce8cbb5f2 100644 --- a/libsolidity/codegen/ArrayUtils.cpp +++ b/libsolidity/codegen/ArrayUtils.cpp @@ -291,8 +291,11 @@ void ArrayUtils::copyArrayToMemory(ArrayType const& _sourceType, bool _padToWord CompilerUtils utils(m_context); unsigned baseSize = 1; if (!_sourceType.isByteArray()) + { // We always pad the elements, regardless of _padToWordBoundaries. baseSize = _sourceType.baseType()->calldataEncodedSize(); + solAssert(baseSize >= 0x20, ""); + } if (_sourceType.location() == DataLocation::CallData) {