From 99ec6702df687b94305519d88cbd213f2320f9df Mon Sep 17 00:00:00 2001 From: LianaHus Date: Thu, 24 Sep 2015 10:51:06 +0200 Subject: improved overflow check in memorySize for ArrayType --- libsolidity/Types.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libsolidity/Types.cpp') diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index 0e24a813..435385e6 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -859,9 +859,9 @@ u256 ArrayType::memorySize() const { solAssert(!isDynamicallySized(), ""); solAssert(m_location == DataLocation::Memory, ""); - u256 size = m_length * m_baseType->memoryHeadSize(); - solAssert(size <= numeric_limits::max(), "Array size does not fit unsigned."); - return size; + bigint size = bigint(m_length) * m_baseType->memoryHeadSize(); + solAssert(size <= numeric_limits::max(), "Array size does not fit u256."); + return u256(size); } TypePointer ArrayType::copyForLocation(DataLocation _location, bool _isPointer) const -- cgit