mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix crash when passing zero to bytes.concat()
This commit is contained in:
@@ -1086,6 +1086,11 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
literalType && literalType->value().size() <= 32
|
||||
)
|
||||
targetTypes.emplace_back(TypeProvider::fixedBytes(static_cast<unsigned>(literalType->value().size())));
|
||||
else if (auto const* literalType = dynamic_cast<RationalNumberType const*>(argument->annotation().type))
|
||||
{
|
||||
solAssert(literalType->value() == 0, "");
|
||||
targetTypes.emplace_back(TypeProvider::fixedBytes(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
solAssert(argument->annotation().type->isImplicitlyConvertibleTo(*TypeProvider::bytesMemory()), "");
|
||||
|
||||
@@ -2476,6 +2476,11 @@ string YulUtilFunctions::bytesConcatFunction(vector<Type const*> const& _argumen
|
||||
literalType && literalType->value().size() <= 32
|
||||
)
|
||||
targetTypes.emplace_back(TypeProvider::fixedBytes(static_cast<unsigned>(literalType->value().size())));
|
||||
else if (auto const* literalType = dynamic_cast<RationalNumberType const*>(argumentType))
|
||||
{
|
||||
solAssert(literalType->value() == 0, "");
|
||||
targetTypes.emplace_back(TypeProvider::fixedBytes(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
solAssert(argumentType->isImplicitlyConvertibleTo(*TypeProvider::bytesMemory()), "");
|
||||
|
||||
Reference in New Issue
Block a user