aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-06 03:47:42 +0800
committerGitHub <noreply@github.com>2018-09-06 03:47:42 +0800
commit522174890f9a376f7b192014774fb2f6d3280356 (patch)
tree38bef8a77b2f169e3b0ce9b6a73859e26086b26c /libsolidity
parent08a7a51f071e2ef30db011fb36d505c7615785ec (diff)
parenta7ffff6a2916a5e501d9a338a82811d53846b777 (diff)
downloaddexon-solidity-522174890f9a376f7b192014774fb2f6d3280356.tar.gz
dexon-solidity-522174890f9a376f7b192014774fb2f6d3280356.tar.zst
dexon-solidity-522174890f9a376f7b192014774fb2f6d3280356.zip
Merge pull request #4872 from bakaoh/issue4716
Crash when array index value is too large
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index a3f4459e..143ac109 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -2209,12 +2209,13 @@ bool TypeChecker::visit(IndexAccess const& _access)
else
{
expectType(*index, IntegerType(256));
- if (auto numberType = dynamic_cast<RationalNumberType const*>(type(*index).get()))
- {
- if (!numberType->isFractional()) // error is reported above
+ if (!m_errorReporter.hasErrors())
+ if (auto numberType = dynamic_cast<RationalNumberType const*>(type(*index).get()))
+ {
+ solAssert(!numberType->isFractional(), "");
if (!actualType.isDynamicallySized() && actualType.length() <= numberType->literalValue(nullptr))
m_errorReporter.typeError(_access.location(), "Out of bounds array access.");
- }
+ }
}
resultType = actualType.baseType();
isLValue = actualType.location() != DataLocation::CallData;