diff options
author | bakaoh <tatattai@gmail.com> | 2018-08-30 11:08:49 +0800 |
---|---|---|
committer | bakaoh <tatattai@gmail.com> | 2018-09-05 11:54:38 +0800 |
commit | a7ffff6a2916a5e501d9a338a82811d53846b777 (patch) | |
tree | 33b5919cde05faa85bd2a4cfa1723d3585f0a2ef /libsolidity/analysis | |
parent | 410d288dfc2e08c42df58c7e01ad5c332ce92727 (diff) | |
download | dexon-solidity-a7ffff6a2916a5e501d9a338a82811d53846b777.tar dexon-solidity-a7ffff6a2916a5e501d9a338a82811d53846b777.tar.gz dexon-solidity-a7ffff6a2916a5e501d9a338a82811d53846b777.tar.bz2 dexon-solidity-a7ffff6a2916a5e501d9a338a82811d53846b777.tar.lz dexon-solidity-a7ffff6a2916a5e501d9a338a82811d53846b777.tar.xz dexon-solidity-a7ffff6a2916a5e501d9a338a82811d53846b777.tar.zst dexon-solidity-a7ffff6a2916a5e501d9a338a82811d53846b777.zip |
Fix #4716: 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 fca64f6a..3b1bfe5c 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2211,12 +2211,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; |