Use calldatacopy for selector retrieval to avoid access out of bounds for calldata.

This commit is contained in:
chriseth
2019-10-31 18:18:36 +01:00
parent 3d1123cf61
commit cee41839f5
4 changed files with 198 additions and 17 deletions
+3 -1
View File
@@ -251,7 +251,9 @@ string IRGenerator::dispatchRoutine(ContractDefinition const& _contract)
Whiskers t(R"X(
if iszero(lt(calldatasize(), 4))
{
let selector := <shr224>(calldataload(0))
mstore(0, 0)
calldatacopy(28, 0, 4)
let selector := mload(0)
switch selector
<#cases>
case <functionSelector>