Skip to content

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

Merged
xavierleroy merged 1 commit intomasterfrom
safe-leaq
Aug 27, 2021
Merged

Protect against overflows in leaq N(src), dst#407
xavierleroy merged 1 commit intomasterfrom
safe-leaq

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