Closed comex closed 1 year ago
Crash is occuring because TypePrinter::GetDefault()
is returning null
>>> import binaryninja; print(binaryninja.types.Type.float(4))
Process 22361 stopped
* thread #2, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000000014b2c7ac4 libbinaryninjacore.1.dylib`::BNGetTypeString(type=0x00000001003f7c30, platform=0x0000000000000000, escaping=NoTokenEscapingType) at typeprinter.cpp:569:50
566
567 char* BNGetTypeString(BNType* type, BNPlatform* platform, BNTokenEscapingType escaping)
568 {
-> 569 return BNAllocString(TypePrinter::GetDefault()->GetTypeString(
570 type->object, platform ? platform->object : nullptr, QualifiedName(), escaping).c_str());
571 }
Work around here is calling binaryninja._init_plugins()
Looks like CoreTypePrinter was not being initialized before init plugins. Now it is initialized if you try to print a type and the default type printer does not exist. Will be fixed on dev >= 3.2.3861
Version and Platform (required):
Bug Description: Trying to use Python APIs without opening a view first causes a crash.
Steps To Reproduce:
It works if I call
open_view
beforehand.Expected Behavior: I'm not sure whether it's intended to be required that you open a view (or perform some other initialization step?) before using these APIs, but if so, it should print an error message rather than crashing.