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

TypeAnalysis/ComplexExpressionRewiter do incorrect rewriting of fields of LARGE_INTEGER union #1159

Open
ptomin opened this issue Feb 21, 2022 · 0 comments
Labels
bug This issue describes a defect in Reko

Comments

@ptomin
Copy link
Collaborator

ptomin commented Feb 21, 2022

See https://github.com/ptomin/reko/blob/6fae491935dce345542de2be03aebbf278cc83a9/subjects/PE/x86/pySample/shingledPySample.reko/pySample_text.c#L444

The type of tLoc14 is LARGE_INTEGER union.

typedef union _LARGE_INTEGER {
  struct {
    DWORD LowPart;
    LONG  HighPart;
  } DUMMYSTRUCTNAME;
  struct {
    DWORD LowPart;
    LONG  HighPart;
  } u;
  LONGLONG QuadPart;
} LARGE_INTEGER;

The result should be

ui32 esi_n = esi_n ^ (tLoc14.HighPart ^ tLoc14.LowPart);

But was

ui32 esi_n = esi_n ^ (tLoc14.dw0004 ^ tLoc14);

It looks like later phase (TypeAnalysis/ComplexExpressionRewiter) can't transform correctly accesses to such unions.

@ptomin ptomin added the bug This issue describes a defect in Reko label Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect in Reko
Projects
None yet
Development

No branches or pull requests

1 participant