aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-09-24 17:55:34 +0800
committerchriseth <c@ethdev.com>2015-09-24 17:55:34 +0800
commit59a2d62c588c6494a83192daddb7dbdb008946a3 (patch)
tree53d9f8d94e413d63781d118d5e9b0fc774f6dcc2
parent52f7e3584350a3d204542ccc982c0951f4c94dc7 (diff)
parent99ec6702df687b94305519d88cbd213f2320f9df (diff)
downloaddexon-solidity-59a2d62c588c6494a83192daddb7dbdb008946a3.tar.gz
dexon-solidity-59a2d62c588c6494a83192daddb7dbdb008946a3.tar.zst
dexon-solidity-59a2d62c588c6494a83192daddb7dbdb008946a3.zip
Merge pull request #94 from LianaHus/sol_improve_PR_83
improved overflow checkings
-rw-r--r--libsolidity/Types.cpp6
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