Vector35 / Vector35/binaryninja-api

Mixing backtick escapes and macro token pasting in C source type definition causes a freeze

Open
#5,696 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Version and Platform (required):

  • Binary Ninja Version: [e.g. 4.0.4000-dev] (if version is stable, please also test the latest development build via the "Update Channel" option)
  • OS: Windows 11
  • OS Version: 10.0.26090
  • CPU Architecture: x64

Bug Description:
When using "Create Types from C Source" function, attempting to define escaped "template-like" type names using macros will throw binary ninja into "not responding" state, forcing a process kill.

Steps To Reproduce:
Please provide all steps required to reproduce the behavior:

  1. Use "Create Types from C Source" function
  2. Provide follwing type definition:
#define K_TY int32_t
#define V_TY int16_t

#define ENTRY_TY(K,V) `map_entry<`##K##`,`##V##`>`

struct ENTRY_TY(K_TY,V_TY)
{
    K_TY key;
    V_TY value;
};
  1. Click on "Create"
  2. Binaryninja freezes

Expected Behavior:
A type named map_entry<int32_t,int16_t> should be created.

Binary:
Reproducible on any binary, including fresh "New Binary Data" context.

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

Start with the Create Types from C Source entry point and reproduce the freeze using the provided ENTRY_TY macro definition in a fresh New Binary Data context. Trace the type parsing and macro token-pasting path, then verify that creation completes and produces a type named map_entry<int32_t,int16_t> without Binary Ninja becoming unresponsive.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.