Failed to detect function parameter if the parameter is used by a subroutine implicitly #6308
Labels
Component: Core
Issue needs changes to the core
Effort: Medium
Issue should take < 1 month
Impact: Medium
Issue is impactful with a bad, or no, workaround
Type: Bug
Issue is a non-crashing bug with repro steps
Version and Platform (required):
Bug Description:
Binary Ninja fails to detect parameter for a function in a simple ELF binary (compiled with
gcc
version 12.2.0 with-Wall -O3
).The function in question is
execute_cgi_command
, and here is a call to it from the binary:We observe that the parameter
rdi
is prepared just before the function call.Moreover, within the function, this parameter is immediately utilized:
Initially, I thought it failed to detect the calling convention, but I can see that it is detected correctly:
Could the zero-byte write before the call (
mov byte [rbx+rax], 0x0
) be confusing Binary Ninja?Compiling with
-O0
resolves the issue, and the call no longer includes this instruction:Compiling with
clang
exhibits the same behavior, whereas compiling witharm-linux-gcc
results in the parameter being detected. I tested an older stable version (4.0) to verify it was not a regression and I had the same issue.Steps To Reproduce:
Please provide all steps required to reproduce the behavior:
recv-01.elf
contained inexample.zip
execute_cgi_command()
functionExpected Behavior:
Function should take a parameter (
char *
)Binary:
example.zip
The text was updated successfully, but these errors were encountered: