You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Binary Ninja Version: 4.3.6738-dev Personal (1e4f6eac)
OS: macOS
OS Version: Sonoma 14.6.1
CPU Architecture: M1
Bug Description:
Seems that when an x86 register is used multiple times with different widths, it is not splitting into multiple variables in MLIL/HLIL. This results in confusing HLIL.
From this code, it looks like result has been erroneously set to void* type even though it is only using it as a uint8_t.
Trying to "fix" this by changing result to a uint8_t makes things even worse (note the .b happens after 1st deref instead of 2nd):
00000000 uint8_t sub_0(void* arg1, uint8_t* arg2)
00000004 uint8_t result = *((*(arg1 + 0x30)).b + 2)
00000007 *arg2 = result
00000009 return result
Steps To Reproduce:
Please provide all steps required to reproduce the behavior:
Create a new window and paste the following x86-64 assembly: 488b47308a40028806c3
Make an x86-64 function and view MLIL. Observe reuse of result as both byte/pointer value.
Expected Behavior:
I would expect result to be split into 2 variables, one for the pointer value and one for the byte value.
It is possible to fix this manually by using the "Split Variable at Definition" feature, but this feels like something that binja should be able to handle automatically.
For comparison, here is how the IDA pseudo-code for the same assembly looks:
Version and Platform (required):
Bug Description:
Seems that when an x86 register is used multiple times with different widths, it is not splitting into multiple variables in MLIL/HLIL. This results in confusing HLIL.
For this assembly:
This MLIL is generated by default:
It is setting the type of
result
tovoid*
and then reusing the same variable for the byte dereference.Although this is semantically correct, it leads to very confusing HLIL:
From this code, it looks like
result
has been erroneously set tovoid*
type even though it is only using it as auint8_t
.Trying to "fix" this by changing
result
to auint8_t
makes things even worse (note the.b
happens after 1st deref instead of 2nd):Steps To Reproduce:
Please provide all steps required to reproduce the behavior:
488b47308a40028806c3
result
as both byte/pointer value.Expected Behavior:
I would expect
result
to be split into 2 variables, one for the pointer value and one for the byte value.It is possible to fix this manually by using the "Split Variable at Definition" feature, but this feels like something that binja should be able to handle automatically.
For comparison, here is how the IDA pseudo-code for the same assembly looks:
Screenshots/Video Recording:
Can record a video if needed, although hopefully explanation above is clear enough.
The text was updated successfully, but these errors were encountered: