Vector35 / Vector35/binaryninja-api

Automatically type all block arguments in function definitions with Block_literal *

Open
#7,342 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When parsing Objective-C and Swift function metadata, you often encounter blocks which are stack or global closures.

When you encounter these, apply a copy of the type Block_literal * to them.

struct Block_literal {
    void *isa;                    // Pointer to block's class ("isa" pointer)
    int flags;                    // Block flags
    int reserved;                 // Reserved for future use
    void (*invoke)(void *, ...);  // Function pointer to the block's code
    struct Block_descriptor *descriptor;  // Pointer to block's descriptor
    // ... captured variables (optional, not part of base header)
};

This type is the base type of all blocks in Objective-C and Swift. It will enable proper type propagation at all the call sites. The type is just the base type -- it can be further refined by parsing the Block_descriptor. I would prefer you make a copy of the block literal, because each call site will be different and we can fine the type in a second pass.

It goes a long way towards making ObjC and Swift easier to reverse

Image

vs

Image

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

The issue names no source file, test, or entry point. Start by locating the parsing of Objective-C and Swift function metadata and block literals; done means block arguments receive copied Block_literal * types and that type propagation reaches their call sites.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, objective-c, swift
Domain
reverse-engineering
Issue type
Feature
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.