aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/2.0.0/utils
diff options
context:
space:
mode:
authorGreg Hysen <hysz@users.noreply.github.com>2018-08-30 04:53:49 +0800
committerGitHub <noreply@github.com>2018-08-30 04:53:49 +0800
commit6cedf5362bb95863660ced59e0af04f97e525619 (patch)
tree3f89f13eafb8ed796c8dd813a41d8d3785332eb4 /packages/contracts/src/2.0.0/utils
parente7d5ceb9c5487a5851dbfc1f8bdbe0182fedaef2 (diff)
parentaa833ef074b5492dec876b2991175cbd9eae599c (diff)
downloaddexon-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')
-rw-r--r--packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol7
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)