diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-06-14 00:36:56 +0800 |
---|---|---|
committer | Remco Bloemen <remco@wicked.ventures> | 2018-06-23 19:53:38 +0800 |
commit | 5c612a186f6b6282323bc7172de22f43c511b8e4 (patch) | |
tree | cb86ed7e87493b1f50e5c4b516550cd131975d3c | |
parent | 943e556f43a328dbb606567b06392851ba4ec3de (diff) | |
download | dexon-sol-tools-5c612a186f6b6282323bc7172de22f43c511b8e4.tar.gz dexon-sol-tools-5c612a186f6b6282323bc7172de22f43c511b8e4.tar.zst dexon-sol-tools-5c612a186f6b6282323bc7172de22f43c511b8e4.zip |
Clean high bits in address
-rw-r--r-- | packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol index cbe4f3be1..c443dda8f 100644 --- a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol +++ b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol @@ -341,6 +341,10 @@ library LibBytes { // 2. Load 32-byte word from memory // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address let neighbors := and(mload(add(b, index)), 0xffffffffffffffffffffffff0000000000000000000000000000000000000000) + + // Make sure input address is clean. + // (Solidity does not guarantee this) + input := and(input, 0xffffffffffffffffffffffffffffffffffffffff) // Store the neighbors and address into memory mstore(add(b, index), xor(input, neighbors)) |