Vector35 / binaryninja-api

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

Opening type list for Foundation causes Binary Ninja to rapidly consume unlimited amounts of memory #3728

Closed saagarjha closed 1 year ago

saagarjha commented 1 year ago

Version and Platform (required):

Bug Description: If I open the types tab for Foundation Binary Ninja quickly uses massive amounts of memory.

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

  1. Open Foundation from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation. Alternatively pick the one I have attached to this bug.
  2. Click on the types tab.

Expected Behavior: The type list shows up.

Additional Information: Please add any other context about the problem here. Foundation.zip

negasora commented 1 year ago

I can't reproduce this with 3.2.3937-dev - are you still running into this problem?

saagarjha commented 1 year ago

Yes. I tried disabling all plugins by launching Binary Ninja with the -p flag too and it didn't help, so I'm not sure if I have any additional configuration I can disable temporarily to try to figure out what's going on?

negasora commented 1 year ago

This is because structure class__TtC10Foundation7IOActor has one member void* $defaultActor at offset 0xfeedfacf, so we're trying to print padding for 0xfeedface bytes. Trying to create, tokenize, and display ~4GB is definitely NOT the right approach here. The fix I have in mind is tracked by https://github.com/Vector35/binaryninja-api/issues/3758

psifertex commented 1 year ago

Note we have another fix in testing tracked under https://github.com/Vector35/binaryninja-api/issues/3600

negasora commented 1 year ago

This was fixed in builds >= 3.2.3971 (with #3600 )