From b546d0c8d8957064424f37f1cae7bc5fc3695f4a Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 11 Feb 2025 13:57:47 -0500 Subject: Fix partial initialization of `DisassemblyTextLine` The usage of `DisassemblyTextLine` in the FFI was unsound, we would forget to initialize some fields causing a myriad of issues where round-tripping through the FFI was losing information. --- binaryninjaapi.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index c80b2510..eac04a53 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -4045,10 +4045,14 @@ namespace BinaryNinja { struct DisassemblyTextLineTypeInfo { bool hasTypeInfo; - BinaryNinja::Ref parentType; + Ref parentType; size_t fieldIndex; uint64_t offset; + BNDisassemblyTextLineTypeInfo GetAPIObject() const; + static void FreeAPIObject(BNDisassemblyTextLineTypeInfo* value); + static DisassemblyTextLineTypeInfo FromAPIObject(const BNDisassemblyTextLineTypeInfo* value); + DisassemblyTextLineTypeInfo() : hasTypeInfo(false), parentType(nullptr), fieldIndex(-1), offset(0) {} }; @@ -4063,6 +4067,10 @@ namespace BinaryNinja { DisassemblyTextLine(); + BNDisassemblyTextLine GetAPIObject() const; + static void FreeAPIObject(BNDisassemblyTextLine* value); + static DisassemblyTextLine FromAPIObject(const BNDisassemblyTextLine* value); + size_t GetTotalWidth() const; size_t GetAddressAndIndentationWidth() const; std::vector GetAddressAndIndentationTokens() const; -- cgit v1.3.1