-
Notifications
You must be signed in to change notification settings - Fork 45
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
Reencoded result doesnt match source code #151
Comments
this is very normal, re-encoding may add or remove bytes prefixes. that has nothing to do with zasm. depends on zydis. |
Is it actually making the instruction bigger or smaller? The encoder typically chooses the smaller encoding, if its the opposite then its best to provide the code to easily reproduce it so I can look into it and also add it to the tests, but I imagine its most likely getting smaller. |
Its making code smaller, and its okay, but relative jumps broke on re-encoding |
What is broken? |
Relative jumps or calls addresses, its just jump on incorrect address |
Can you provide an example to reproduce this? There are various tests for this already so I need a bit more information to reproduce the issue. |
I add this code in first message |
This is pure guessing, as there aren't many details about the issue, but I think what's happening is this: While decoding the original text section's code, you're not replacing raw references to addresses with zasm's labels. When code changes its size, the referenced parts of the image aren't relocated |
I've made some changes to the encoder, check if it helps. I can't really do much with your code without having also the input data. If you provide the raw bytes or better just copy the disassembly directly from x64dbg so I can try to reproduce the issue. |
When I decode and then encode the code back (unchanged), it is different (for example sub opcode size).
code:
The text was updated successfully, but these errors were encountered: