Merge pull request #9836 from ethereum/fix-missing-check-for-nested-dynamic-arrays-with-abi-encode-decode-v1

Add missing check for nested dynamic arrays in abi.encode()/decode() functions in ABIEncoderV1
This commit is contained in:
chriseth
2020-09-22 15:49:17 +02:00
committed by GitHub
10 changed files with 81 additions and 2 deletions
+8 -2
View File
@@ -344,10 +344,16 @@ TypePointer Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) c
return encodingType;
TypePointer baseType = encodingType;
while (auto const* arrayType = dynamic_cast<ArrayType const*>(baseType))
{
baseType = arrayType->baseType();
if (dynamic_cast<StructType const*>(baseType))
if (!_encoderV2)
auto const* baseArrayType = dynamic_cast<ArrayType const*>(baseType);
if (!_encoderV2 && baseArrayType && baseArrayType->isDynamicallySized())
return nullptr;
}
if (!_encoderV2 && dynamic_cast<StructType const*>(baseType))
return nullptr;
return encodingType;
}