From 0cc77206c79257d49013c3a3ed1bf889c85b10d1 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Sun, 14 Jan 2018 03:42:04 -0500 Subject: Container Memory Reservations. --- binaryviewtype.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'binaryviewtype.cpp') diff --git a/binaryviewtype.cpp b/binaryviewtype.cpp index e23838f6..e8ef4f53 100644 --- a/binaryviewtype.cpp +++ b/binaryviewtype.cpp @@ -83,6 +83,7 @@ vector> BinaryViewType::GetViewTypes() types = BNGetBinaryViewTypes(&count); vector> result; + result.reserve(count); for (size_t i = 0; i < count; i++) result.push_back(new CoreBinaryViewType(types[i])); @@ -98,6 +99,7 @@ vector> BinaryViewType::GetViewTypesForData(BinaryView* data types = BNGetBinaryViewTypesForData(data->GetObject(), &count); vector> result; + result.reserve(count); for (size_t i = 0; i < count; i++) result.push_back(new CoreBinaryViewType(types[i])); -- cgit v1.3.1 From 5ceebf3406f9e57434655b18db8b0bcf9b981f15 Mon Sep 17 00:00:00 2001 From: Ryan Snyder Date: Thu, 21 Jun 2018 20:39:33 -0400 Subject: c++: Allow custom BinaryViewTypes to fail gracefully --- binaryviewtype.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'binaryviewtype.cpp') diff --git a/binaryviewtype.cpp b/binaryviewtype.cpp index e8ef4f53..233fdb87 100644 --- a/binaryviewtype.cpp +++ b/binaryviewtype.cpp @@ -29,6 +29,8 @@ BNBinaryView* BinaryViewType::CreateCallback(void* ctxt, BNBinaryView* data) BinaryViewType* type = (BinaryViewType*)ctxt; Ref view = new BinaryView(BNNewViewReference(data)); Ref result = type->Create(view); + if (result == nullptr) + return nullptr; return BNNewViewReference(result->GetObject()); } -- cgit v1.3.1 From 8833eeb4c3b89f3ba6423b7f67a1a4277cabfc82 Mon Sep 17 00:00:00 2001 From: Ryan Snyder Date: Thu, 28 Jun 2018 06:58:06 -0400 Subject: Fix lifting of intrinsics in Python bindings --- binaryviewtype.cpp | 2 +- python/lowlevelil.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'binaryviewtype.cpp') diff --git a/binaryviewtype.cpp b/binaryviewtype.cpp index 233fdb87..762b2de7 100644 --- a/binaryviewtype.cpp +++ b/binaryviewtype.cpp @@ -29,7 +29,7 @@ BNBinaryView* BinaryViewType::CreateCallback(void* ctxt, BNBinaryView* data) BinaryViewType* type = (BinaryViewType*)ctxt; Ref view = new BinaryView(BNNewViewReference(data)); Ref result = type->Create(view); - if (result == nullptr) + if (!result) return nullptr; return BNNewViewReference(result->GetObject()); } diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 34048704..bd1e9349 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -1809,8 +1809,9 @@ class LowLevelILFunction(object): param_list = [] for param in params: param_list.append(param.index) - return self.expr(LowLevelILOperation.LLIL_INTRINSIC, len(outputs), self.add_operand_list(output_list), - self.arch.get_intrinsic_index(intrinsic), len(params), self.add_operand_list(param_list), flags = flags) + call_param = self.expr(LowLevelILOperation.LLIL_CALL_PARAM, len(params), self.add_operand_list(param_list).index) + return self.expr(LowLevelILOperation.LLIL_INTRINSIC, len(outputs), self.add_operand_list(output_list).index, + self.arch.get_intrinsic_index(intrinsic), call_param.index, flags = flags) def breakpoint(self): """ -- cgit v1.3.1