diff options
author | chriseth <chris@ethereum.org> | 2018-09-06 03:47:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-06 03:47:42 +0800 |
commit | 522174890f9a376f7b192014774fb2f6d3280356 (patch) | |
tree | 38bef8a77b2f169e3b0ce9b6a73859e26086b26c /libsolidity/analysis | |
parent | 08a7a51f071e2ef30db011fb36d505c7615785ec (diff) | |
parent | a7ffff6a2916a5e501d9a338a82811d53846b777 (diff) | |
download | dexon-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/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 9 |
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; |