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

Protect against overflows in leaq N(src), dst #407

Merged
merged 1 commit into from
Aug 27, 2021
Merged

Conversation

xavierleroy
Copy link
Contributor

If N does not fit in signed 32 bits, leaq cannot be used and mov; addq must be used instead.

This was already the case for leaq instructions produced by the Asmgen pass, but not for some leaq instructions produced by Asmexpand.

Normally, assemblers should fail if the leaq offset is not representable, but this is not always the case (see issue #406).

Fixes: #406

If N does not fit in signed 32 bits, `leaq` cannot be used and
`mov; addq` must be used instead.

This was already the case for `leaq` instructions produced by the Asmgen
pass, but not for some `leaq` instructions produced by Asmexpand.

Normally, assemblers should fail if the `leaq` offset is not representable,
but this is not always the case (see issue #406).

Fixes: #406
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.

Oversize leaq operand in stack chaining MacOS x86_64
1 participant