-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changed the checks for generateOrder
's return data ABI encoding
#57
Conversation
// If valid length, check that offsets word boundaries are within returndata. | ||
let invalidOfferOffset := | ||
gt( | ||
add(offsetOffer, OneWord), | ||
returndatasize() | ||
) | ||
let invalidConsiderationOffset := | ||
gt(offsetConsideration, returndatasize()) | ||
gt( | ||
add(offsetConsideration, OneWord), | ||
returndatasize() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed these checks too, since the offsets might be less than returndatasize()
but the diffs might be less than one word which would cause reading passed the returndatasize()
.
// Don't continue if returndatasize exceeds 65535 bytes | ||
// or is greater than the calculated size. | ||
// or less than the end offsets. | ||
invalidEncoding := | ||
or( | ||
gt( | ||
or(offerLength, considerationLength), | ||
generateOrder_maximum_returndatasize | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check does not match with the comment. @0age
The comment says:
// Don't continue if returndatasize exceeds 65535 bytes
But here we are checking the or(offerLength, considerationLength)
against generateOrder_maximum_returndatasize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we definitely still want to keep the constraint on array length just to protect against funky overflow scenarios in the preceding logic; the size of returndata is still somewhat constrained by comparison against the derived offsets as well
I'd say generateOrder_maximum_returned_array_length
would be more accurate for the name; and comment could just say // Don't continue if either offer or consideration length exceeds 65535
or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aside from the one named constant & comment fix, LGTM
addresses: