diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index 65f9e1723..d24dfc078 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -1454,7 +1454,7 @@ string ABIFunctions::calldataAccessFunction(Type const& _type) length := calldataload(value) value := add(value, 0x20) if gt(length, 0xffffffffffffffff) { () } - if sgt(base_ref, sub(calldatasize(), mul(length, ))) { () } + if sgt(value, sub(calldatasize(), mul(length, ))) { () } )") ("calldataStride", toCompactHexWithPrefix(arrayType->calldataStride())) // TODO add test diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_nested_array_reencode.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_nested_array_reencode.sol index d7ff1999b..042ad586e 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_nested_array_reencode.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_nested_array_reencode.sol @@ -14,10 +14,10 @@ contract C { // revertStrings: debug // ---- // h(uint256[][]): 0x20, 1, 0x20, 0 -> -// h(uint256[][]): 0x20, 1, 0x20, 1 -> -// h(uint256[][]): 0x20, 1, 0x20, 2 -> +// h(uint256[][]): 0x20, 1, 0x20, 1 -> FAILURE, hex"08c379a0", 0x20, 0x1e, "Invalid calldata access stride" +// h(uint256[][]): 0x20, 1, 0x20, 2 -> FAILURE, hex"08c379a0", 0x20, 0x1e, "Invalid calldata access stride" // h(uint256[][]): 0x20, 1, 0x20, 3 -> FAILURE, hex"08c379a0", 0x20, 0x1e, "Invalid calldata access stride" // f((uint256[])): 0x20, 0x20, 0 -> -// f((uint256[])): 0x20, 0x20, 1 -> -// f((uint256[])): 0x20, 0x20, 2 -> +// f((uint256[])): 0x20, 0x20, 1 -> FAILURE, hex"08c379a0", 0x20, 0x1e, "Invalid calldata access stride" +// f((uint256[])): 0x20, 0x20, 2 -> FAILURE, hex"08c379a0", 0x20, 0x1e, "Invalid calldata access stride" // f((uint256[])): 0x20, 0x20, 3 -> FAILURE, hex"08c379a0", 0x20, 0x1e, "Invalid calldata access stride"