Skip to content
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

sb-i74 #325

Merged
merged 1 commit into from
Sep 2, 2024
Merged

sb-i74 #325

merged 1 commit into from
Sep 2, 2024

Conversation

dianakocsis
Copy link
Contributor

Related Issue

Spearbit I-74 Memory Cleaning
https://github.com/spearbit-audits/review-uniswap-v4/issues/74

Description of changes

clean the memory we used

@@ -46,6 +46,11 @@ contract EIP712_v4 is IEIP712_v4 {
mstore(add(fmp, 0x02), domainSeparator)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hensha256 when is it left packed vs right packed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bytes are left-aligned, numbers and addresses are right-aligned. So the line above this

      mstore(fmp, hex"1901")

stores 0x1901 in [fmp..fmp+2)
whereas if you wrote

      mstore(fmp, 6401)     // 6401 == 0x1901

it would right align it into [fmp+30..fmp+32)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact even just mstore(fmp, 0x1901) would right align it because 0x1901 gets compiled as a number. You have to write hex"1901" for it to compile it as bytes and left-align

@dianakocsis dianakocsis requested a review from hensha256 August 31, 2024 01:50
@dianakocsis dianakocsis merged commit 20863db into main Sep 2, 2024
3 checks passed
@dianakocsis dianakocsis deleted the sb-i74 branch September 2, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants