From c66477c69097b15b90d9474222e308baeaa929a6 Mon Sep 17 00:00:00 2001 From: Remco Bloemen Date: Wed, 13 Jun 2018 18:37:12 +0200 Subject: Clean low bits in bytes4 --- packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol index c443dda8f..4a1397470 100644 --- a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol +++ b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol @@ -451,6 +451,9 @@ library LibBytes { ); assembly { result := mload(add(b, 32)) + // Solidity does not require us to clean the trailing bytes. + // We do it anyway + result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000) } return result; } -- cgit v1.2.3