mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix crash when passing empty strings to bytes.concat()
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
contract C {
|
||||
function f() public returns (bytes memory) {
|
||||
bytes memory b = "";
|
||||
return bytes.concat(
|
||||
bytes.concat(b),
|
||||
bytes.concat(b, b),
|
||||
bytes.concat("", b),
|
||||
bytes.concat(b, "")
|
||||
);
|
||||
}
|
||||
|
||||
function g() public returns (bytes memory) {
|
||||
return bytes.concat("", "abc", hex"", "abc", unicode"");
|
||||
}
|
||||
|
||||
function h() public returns (bytes memory) {
|
||||
bytes memory b = "";
|
||||
return bytes.concat(b, "abc", b, "abc", b);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileToEwasm: also
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0x20, 0
|
||||
// g() -> 0x20, 6, "abcabc"
|
||||
// h() -> 0x20, 6, "abcabc"
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
bytes.concat(hex"", unicode"", "");
|
||||
}
|
||||
}
|
||||
// ----
|
||||
Reference in New Issue
Block a user