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

Fix typo in aarch64_immhi_page decode #1496

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

AeonLucid
Copy link
Contributor

@AeonLucid AeonLucid commented Aug 3, 2024

This fixes a typo in the decoding of aarch64_immhi_page.
I assume this code was copied from aarch64_immhip_page and someone forgot to change the shift afterwards.

The value 524020 (and immlo.value 0) decodes to ExprInt(0xFFFFFFFFFFFFFAC8, 64).

Before it would fail to re-encode this due to incorrectly assuming an overflow (v > (1 << 19) - 1).
After the change it re-encodes back to 524020.


Fixes #1495.

@serpilliere
Copy link
Contributor

Hi @AeonLucid
Thank you for the fix.
I saw in the issue that you have an example:

0xC7100: ADR X29, sub_C6BC8 ; Instruction in hex [5D D6 FF 10]

Can you add it to the regression test? Or may and it to this pr?

@AeonLucid
Copy link
Contributor Author

Hi @AeonLucid

Thank you for the fix.

I saw in the issue that you have an example:


0xC7100: ADR X29, sub_C6BC8 ; Instruction in hex [5D D6 FF 10]

Can you add it to the regression test? Or may and it to this pr?

I couldn't find any regression tests where I could add this instruction to. Can you point me to them?

@serpilliere
Copy link
Contributor

Hi @AeonLucid

There are asm/disasm regressions tests in /miasm/test/arch/aarch64/arch.py

For example

reg_tests_aarch64 = [

    ("XXXXXXXX    MOV        W1, WZR",
     "E1031F2A"),
...

which means "MOV W1, WZR" gives bytes "E1031F2A", and vice versa

Tell me if you want to give it a try (I will add it in the other case)

Thankt you!

@AeonLucid
Copy link
Contributor Author

I have added a regression test, let me know if you want any other changes. @serpilliere

@serpilliere serpilliere merged commit 243e4f0 into cea-sec:master Aug 20, 2024
3 checks passed
@serpilliere
Copy link
Contributor

Thank you for the fix @AeonLucid !!

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.

Failing to assemble ADR X29 0xFFFFFFFFFFFFFAC8 due to missing offset
2 participants