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

fix sub flags calculation #728

Merged
merged 1 commit into from Oct 11, 2017

Conversation

Projects
None yet
2 participants
@gitoleg
Contributor

gitoleg commented Oct 11, 2017

Consider next subb %al, %al that looks like following:

1  v1 := low:8[EAX]
2  EAX := extract:31:8[EAX].0
3  OF := high:1[(v1 ^ low:8[EAX]) & (v1 ^ low:8[EAX])]
4  ...

Operands and destination are the same. And after second line it's incorrect to use eax register as operand, since its value was changed.
So what we do need here is to use temporary variables for operands:

1  v1 := low:8[EAX]
2  v2 := low:8[EAX]
3  EAX := extract:31:8[EAX].0
4  OF := high:1[(v2 ^ v1) & (v2 ^ low:8[EAX])]
5  ...
fix sub flags calculation
Flags were calculated wrong in case when src and dst
operands were the same, e.g. `sub %eax, %eax`

@gitoleg gitoleg referenced this pull request Oct 11, 2017

Closed

Fix semantic bugs found by the KAIST team #708

6 of 6 tasks complete
@ivg

ivg approved these changes Oct 11, 2017

@ivg ivg merged commit 23a1744 into BinaryAnalysisPlatform:master Oct 11, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@gitoleg gitoleg deleted the gitoleg:fix-sub branch Mar 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment