File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,11 @@ def __repr__(self):
27
27
return f"StringSlice(address={ self .address :#x} , length={ self .length :#x} , data={ self .data !r} )"
28
28
29
29
@classmethod
30
- def create_binary_ninja_type (
31
- cls , bv : BinaryView
32
- ): # TODO: check for existence of type
30
+ def check_binary_ninja_type_exists (cls , bv : BinaryView ) -> bool :
31
+ return bv .get_type_by_name ("RustStringSlice" ) is not None
32
+
33
+ @classmethod
34
+ def create_binary_ninja_type (cls , bv : BinaryView ):
33
35
if bv .arch is not None :
34
36
rust_string_slice_bn_type_obj = StructureBuilder .create (packed = True )
35
37
rust_string_slice_bn_type_obj .append (
@@ -337,10 +339,12 @@ def run(self):
337
339
338
340
339
341
def action_recover_string_slices_from_code (bv : BinaryView ):
340
- RustStringSlice .create_binary_ninja_type (bv )
342
+ if not RustStringSlice .check_binary_ninja_type_exists (bv ):
343
+ RustStringSlice .create_binary_ninja_type (bv )
341
344
RecoverStringFromCodeTask (bv = bv ).start ()
342
345
343
346
344
347
def action_recover_string_slices_from_readonly_data (bv : BinaryView ):
345
- RustStringSlice .create_binary_ninja_type (bv )
348
+ if not RustStringSlice .check_binary_ninja_type_exists (bv ):
349
+ RustStringSlice .create_binary_ninja_type (bv )
346
350
RecoverStringFromReadOnlyDataTask (bv = bv ).start ()
You can’t perform that action at this time.
0 commit comments