aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/ReferencesResolver.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-26 20:55:07 +0800
committerGitHub <noreply@github.com>2018-09-26 20:55:07 +0800
commit13cd7c3fed1c7a9e671b2580aa3d81fb45024faa (patch)
tree0e06a904c4f8e0fce6299a3bc529a041809d08e1 /libsolidity/analysis/ReferencesResolver.cpp
parent46f630c5a67965acb31dead1ac19373e58097ea2 (diff)
parent79307059e502f1383e1ac50cd7af783aec6588a2 (diff)
downloaddexon-solidity-13cd7c3fed1c7a9e671b2580aa3d81fb45024faa.tar.gz
dexon-solidity-13cd7c3fed1c7a9e671b2580aa3d81fb45024faa.tar.zst
dexon-solidity-13cd7c3fed1c7a9e671b2580aa3d81fb45024faa.zip
Merge pull request #5061 from ethereum/fixedSizeArrayLength
Disallow fixed-size arrays with zero length
Diffstat (limited to 'libsolidity/analysis/ReferencesResolver.cpp')
-rw-r--r--libsolidity/analysis/ReferencesResolver.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp
index 8a576e2e..81de3c43 100644
--- a/libsolidity/analysis/ReferencesResolver.cpp
+++ b/libsolidity/analysis/ReferencesResolver.cpp
@@ -246,6 +246,8 @@ void ReferencesResolver::endVisit(ArrayTypeName const& _typeName)
RationalNumberType const* lengthType = dynamic_cast<RationalNumberType const*>(lengthTypeGeneric.get());
if (!lengthType || !lengthType->mobileType())
fatalTypeError(length->location(), "Invalid array length, expected integer literal or constant expression.");
+ else if (lengthType->isZero())
+ fatalTypeError(length->location(), "Array with zero length specified.");
else if (lengthType->isFractional())
fatalTypeError(length->location(), "Array with fractional length specified.");
else if (lengthType->isNegative())