Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
901 stars 202 forks source link

Hang on huge arrays inside structure variables #4159

Open CouleeApps opened 1 year ago

CouleeApps commented 1 year ago

Version and Platform (required):

Bug Description: When I make a huge array inside of a structure, then annotate a variable in linear view with that structure type, everything gets very slow.

Steps To Reproduce:

  1. Open a large raw binary
  2. Create a structure like struct foo { uint32_t bar[0x80000]; };
  3. Apply that structure to the first byte in the raw view
  4. Ow my foot why was i allowed to shoot it

Expected Behavior: I expected maybe to be able to shoot myself in the foot with a hugeass array inside a structure and not have the app freeze.

Screenshots: [Imagine a macOS rainbow swirly here]

Additional Information: Does not apply to arrays outside of structures due to recent optimizations in the array rendering for linear view. MAYBE EVENTUALLY those will be written for structures too, but this issue is annoying in the meantime.

CouleeApps commented 1 year ago

There's currently a 0x100000 element limit on arrays, which (somehow) is way too large for reasonable performance.

Proposed solution: make limit lower and (why not) configurable via options.

Secondary problem: you could also have 0x100000 lines of hex dump in your structure too. Same proposed solution.

CouleeApps commented 1 year ago

This is addressed partially in 3.4.4175-dev with the lower limits. The Real Fix (TM) of optimizing linear view rendering of structures the same way as arrays were has not been implemented yet. I'm leaving this issue open to track that progress.