Sanity check on order offset when hashing
This commit is contained in:
parent
f477c0fcc2
commit
1dc1218bfc
@ -67,7 +67,7 @@ library LibOrder {
|
|||||||
address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.
|
address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.
|
||||||
uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0.
|
uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0.
|
||||||
uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0.
|
uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0.
|
||||||
uint256 makerFee; // Fee paid to feeRecipient by maker when order is filled.
|
uint256 makerFee; // Fee paid to feeRecipient by maker when order is filled.
|
||||||
uint256 takerFee; // Fee paid to feeRecipient by taker when order is filled.
|
uint256 takerFee; // Fee paid to feeRecipient by taker when order is filled.
|
||||||
uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires.
|
uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires.
|
||||||
uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash.
|
uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash.
|
||||||
@ -133,6 +133,11 @@ library LibOrder {
|
|||||||
// ));
|
// ));
|
||||||
|
|
||||||
assembly {
|
assembly {
|
||||||
|
// Assert order offset (this is an internal error that should never be triggered)
|
||||||
|
if lt(order, 32) {
|
||||||
|
invalid()
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate memory addresses that will be swapped out before hashing
|
// Calculate memory addresses that will be swapped out before hashing
|
||||||
let pos1 := sub(order, 32)
|
let pos1 := sub(order, 32)
|
||||||
let pos2 := add(order, 320)
|
let pos2 := add(order, 320)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user