diff options
author | Greg Hysen <hysz@users.noreply.github.com> | 2018-08-30 04:53:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-30 04:53:49 +0800 |
commit | 6cedf5362bb95863660ced59e0af04f97e525619 (patch) | |
tree | 3f89f13eafb8ed796c8dd813a41d8d3785332eb4 /packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol | |
parent | e7d5ceb9c5487a5851dbfc1f8bdbe0182fedaef2 (diff) | |
parent | aa833ef074b5492dec876b2991175cbd9eae599c (diff) | |
download | dexon-sol-tools-6cedf5362bb95863660ced59e0af04f97e525619.tar dexon-sol-tools-6cedf5362bb95863660ced59e0af04f97e525619.tar.gz dexon-sol-tools-6cedf5362bb95863660ced59e0af04f97e525619.tar.bz2 dexon-sol-tools-6cedf5362bb95863660ced59e0af04f97e525619.tar.lz dexon-sol-tools-6cedf5362bb95863660ced59e0af04f97e525619.tar.xz dexon-sol-tools-6cedf5362bb95863660ced59e0af04f97e525619.tar.zst dexon-sol-tools-6cedf5362bb95863660ced59e0af04f97e525619.zip |
Merge pull request #1039 from 0xProject/fix/contracts/audit2Fixes
Fixes as-per Audit for LibBytes + ERC20 Proxy Comments
Diffstat (limited to 'packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol')
-rw-r--r-- | packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol b/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol index 504e950a8..93873cbcc 100644 --- a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol +++ b/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol @@ -467,8 +467,13 @@ library LibBytes { b.length >= index + 4, "GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED" ); + + // Arrays are prefixed by a 32 byte length field + index += 32; + + // Read the bytes4 from array memory assembly { - result := mload(add(b, 32)) + result := mload(add(b, index)) // Solidity does not require us to clean the trailing bytes. // We do it anyway result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000) |