diff options
author | LianaHus <liana@ethdev.com> | 2015-09-24 16:51:06 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-09-24 16:51:06 +0800 |
commit | 99ec6702df687b94305519d88cbd213f2320f9df (patch) | |
tree | 53d9f8d94e413d63781d118d5e9b0fc774f6dcc2 /libsolidity | |
parent | 52f7e3584350a3d204542ccc982c0951f4c94dc7 (diff) | |
download | dexon-solidity-99ec6702df687b94305519d88cbd213f2320f9df.tar.gz dexon-solidity-99ec6702df687b94305519d88cbd213f2320f9df.tar.zst dexon-solidity-99ec6702df687b94305519d88cbd213f2320f9df.zip |
improved overflow check in memorySize for ArrayType
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/Types.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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<unsigned>::max(), "Array size does not fit unsigned."); - return size; + bigint size = bigint(m_length) * m_baseType->memoryHeadSize(); + solAssert(size <= numeric_limits<unsigned>::max(), "Array size does not fit u256."); + return u256(size); } TypePointer ArrayType::copyForLocation(DataLocation _location, bool _isPointer) const |