Vector35 / Vector35/binaryninja-api

Support for conditional no-return

Open
#4,057 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Effort: Medium Impact: Low
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Version and Platform (required):

  • Binary Ninja Version: 3.4.4102-dev
  • OS: Arch Linux
  • OS Version: -
  • CPU Architecture: x86_64

Bug Description:
Displaying/using a wrong edge between two basic blocks, where the last instruction of the first basic block has a non zero status call to error(x,...).

Steps To Reproduce:
Use the graph view on main in a.out.zip in any IL.
Or for the API: Iterate over the outgoing_edges of MediumLevelILBasicBlock in the block (or any other IL) where the error(1,...) call is.

Expected Behavior:
As described in the error map page a non zero status call of error will call exit instead of continuing.
Therefore the edge between the two edges should not exists, if a constant non zero value is used for error.

Screenshots:
error

Additional Information:
If the compiler optimization level is aggressive enough it will account for the different behavior of the status field of error and place the code accordingly resulting in this problem.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the graph view on main using the linked a.out.zip, then inspect outgoing_edges on the affected MediumLevelILBasicBlock in the relevant IL. Compare behavior around error(1,...) with the error(3) semantics described in the linked man page. Done means the non-zero constant status produces no outgoing edge to the subsequent block.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.