mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fixup! BytesUtils: Don't introduce garbage when formatting byte vectors shorter than expected
This commit is contained in:
parent
0f5aacefa0
commit
397a5543a4
@ -283,7 +283,10 @@ string BytesUtils::formatRawBytes(
|
||||
|
||||
for (auto const& parameter: parameters)
|
||||
{
|
||||
long actualSize = min(distance(it, _bytes.end()), static_cast<long>(parameter.abiType.size));
|
||||
long actualSize = min(
|
||||
distance(it, _bytes.end()),
|
||||
static_cast<ParameterList::difference_type>(parameter.abiType.size)
|
||||
);
|
||||
bytes byteRange(parameter.abiType.size, 0);
|
||||
copy(it, it + actualSize, byteRange.begin());
|
||||
|
||||
@ -404,7 +407,10 @@ string BytesUtils::formatBytesRange(
|
||||
|
||||
for (auto const& parameter: parameters)
|
||||
{
|
||||
long actualSize = min(distance(it, _bytes.end()), static_cast<long>(parameter.abiType.size));
|
||||
long actualSize = min(
|
||||
distance(it, _bytes.end()),
|
||||
static_cast<ParameterList::difference_type>(parameter.abiType.size)
|
||||
);
|
||||
bytes byteRange(parameter.abiType.size, 0);
|
||||
copy(it, it + actualSize, byteRange.begin());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user