From 397a5543a4b8a42cb97d76b76181394abfd69be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 17 Aug 2023 20:45:16 +0200 Subject: [PATCH] fixup! BytesUtils: Don't introduce garbage when formatting byte vectors shorter than expected --- test/libsolidity/util/BytesUtils.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/libsolidity/util/BytesUtils.cpp b/test/libsolidity/util/BytesUtils.cpp index 57d7e12c6..58d1baacd 100644 --- a/test/libsolidity/util/BytesUtils.cpp +++ b/test/libsolidity/util/BytesUtils.cpp @@ -283,7 +283,10 @@ string BytesUtils::formatRawBytes( for (auto const& parameter: parameters) { - long actualSize = min(distance(it, _bytes.end()), static_cast(parameter.abiType.size)); + long actualSize = min( + distance(it, _bytes.end()), + static_cast(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(parameter.abiType.size)); + long actualSize = min( + distance(it, _bytes.end()), + static_cast(parameter.abiType.size) + ); bytes byteRange(parameter.abiType.size, 0); copy(it, it + actualSize, byteRange.begin());