diff options
Diffstat (limited to 'contracts')
-rw-r--r-- | contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol | 7 | ||||
-rw-r--r-- | contracts/libs/contracts/libs/LibAddressArray.sol | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol b/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol index 2917403bd..ab6989115 100644 --- a/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol +++ b/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol @@ -70,9 +70,10 @@ contract MixinBalanceThresholdFilterCore is IThresholdAsset thresholdAsset = THRESHOLD_ASSET; for (uint256 i = 0; i < addressesToValidate.length; ++i) { uint256 addressBalance = thresholdAsset.balanceOf(addressesToValidate[i]); - if (addressBalance < balanceThreshold) { - revert("AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD"); - } + require( + addressBalance >= balanceThreshold, + "AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD" + ); } emit ValidatedAddresses(addressesToValidate); diff --git a/contracts/libs/contracts/libs/LibAddressArray.sol b/contracts/libs/contracts/libs/LibAddressArray.sol index db76ddedb..ccae2ac5f 100644 --- a/contracts/libs/contracts/libs/LibAddressArray.sol +++ b/contracts/libs/contracts/libs/LibAddressArray.sol @@ -45,11 +45,20 @@ library LibAddressArray { addressArrayEndPtr := add(addressArray, addressArrayMemSizeInBytes) } + // Cases for `freeMemPtr`: + // `freeMemPtr` == `addressArrayEndPtr`: Nothing occupies memory after `addressArray` + // `freeMemPtr` > `addressArrayEndPtr`: Some value occupies memory after `addressArray` + // `freeMemPtr` < `addressArrayEndPtr`: Memory has not been managed properly. + require( + freeMemPtr >= addressArrayEndPtr, + "INVALID_FREE_MEMORY_PTR" + ); + // If free memory begins at the end of `addressArray` // then we can append `addressToAppend` directly. // Otherwise, we must copy the array to free memory // before appending new values to it. - if (freeMemPtr != addressArrayEndPtr) { + if (freeMemPtr > addressArrayEndPtr) { LibBytes.memCopy(freeMemPtr, addressArrayBeginPtr, addressArrayMemSizeInBytes); assembly { addressArray := freeMemPtr |