aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-12 04:56:09 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-14 04:33:46 +0800
commitcb4875a28b1595f31f1eb2d54464f5c3dfc66115 (patch)
tree2c18481b2d8fbd4d71ee7a5414229381f570a58e /libsolidity/analysis
parent63bf0f68e6d232eccf6d64ca2bba5b39e108ea41 (diff)
downloaddexon-solidity-cb4875a28b1595f31f1eb2d54464f5c3dfc66115.tar
dexon-solidity-cb4875a28b1595f31f1eb2d54464f5c3dfc66115.tar.gz
dexon-solidity-cb4875a28b1595f31f1eb2d54464f5c3dfc66115.tar.bz2
dexon-solidity-cb4875a28b1595f31f1eb2d54464f5c3dfc66115.tar.lz
dexon-solidity-cb4875a28b1595f31f1eb2d54464f5c3dfc66115.tar.xz
dexon-solidity-cb4875a28b1595f31f1eb2d54464f5c3dfc66115.tar.zst
dexon-solidity-cb4875a28b1595f31f1eb2d54464f5c3dfc66115.zip
Issue error properly for oversized arrays for calldata
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 4e5a11ed..56f9c764 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -583,6 +583,12 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
!FunctionType(_variable).interfaceFunctionType()
)
m_errorReporter.typeError(_variable.location(), "Internal type is not allowed for public state variables.");
+
+ if (varType->category() == Type::Category::Array)
+ if (auto arrayType = dynamic_cast<ArrayType const*>(varType.get()))
+ if ((arrayType->location() == DataLocation::CallData) && !arrayType->validForCalldata())
+ m_errorReporter.typeError(_variable.location(), "Array is too large to be encoded as calldata.");
+
return false;
}