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

XINST_CREATE_add with 2 registers produces an unencodable instruction on x86 #4861

Closed
derekbruening opened this issue Apr 20, 2021 · 0 comments · Fixed by #4862
Closed

XINST_CREATE_add with 2 registers produces an unencodable instruction on x86 #4861

derekbruening opened this issue Apr 20, 2021 · 0 comments · Fixed by #4862
Assignees

Comments

@derekbruening
Copy link
Contributor

This code:

        XINST_CREATE_add(drcontext, opnd_create_reg(reg_val), opnd_create_reg(reg_ptr));

Produces an encoding error. It's because it tries to create a LEA base-disp with an index register but a 0 scale which is not allowed.

The same bug exists in XINST_CREATE_add_2src on x86.

@derekbruening derekbruening self-assigned this Apr 20, 2021
derekbruening added a commit that referenced this issue Apr 20, 2021
XINST_CREATE_add leaves the scale as 0 even when an index register is
present, which does not encode.  We fix that here, along with fixing
the same bug in XINST_CREATE_add_2src.

A test case is added.

Fixes #4861
derekbruening added a commit that referenced this issue Apr 20, 2021
XINST_CREATE_add leaves the scale as 0 even when an index register is
present, which does not encode.  We fix that here, along with fixing
the same bug in XINST_CREATE_add_2src.

A test case is added.

Fixes #4861
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 a pull request may close this issue.

1 participant