Merge pull request #94 from LianaHus/sol_improve_PR_83

improved overflow checkings
This commit is contained in:
chriseth 2015-09-24 11:55:34 +02:00
commit 59a2d62c58

View File

@ -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