_component_data_variable_added passes the raw BNDataVariable pointer to
DataVariable.from_core_struct, which expects a dereferenced struct.
File "binaryninja/binaryview.py", line 1481, in _component_data_variable_added
self._notify.component_data_var_added(self._view, result,
DataVariable.from_core_struct(var, self._view))
File "binaryninja/binaryview.py", line 12255, in from_core_struct
core.BNNewTypeReference(var.type), platform=view.platform,
^^^^^^^^
AttributeError: 'LP_BNDataVariable' object has no attribute 'type'
The three non-component callbacks dereference correctly; the two component ones
do not:
1171 data_var_added from_core_struct(var[0], ...) ok
1177 data_var_removed from_core_struct(var[0], ...) ok
1183 data_var_updated from_core_struct(var[0], ...) ok
1481 component_data_var_added from_core_struct(var, ...) throws
1491 component_data_var_removed from_core_struct(var, ...) throws
The type annotations on the component callbacks are also wrong: declared
var: core.BNDataVariable, actually receive LP_BNDataVariable. The working ones
correctly declare core.BNDataVariableHandle.
FIX: var -> var[0] at lines 1481 and 1491; correct the annotations.
REPRODUCE (no plugin needed):
load any binary, register a BinaryDataNotification implementing
component_data_var_added, then bv.create_component() and
component.add_data_variable(dv).
_component_data_variable_addedpasses the rawBNDataVariablepointer toDataVariable.from_core_struct, which expects a dereferenced struct.The three non-component callbacks dereference correctly; the two component ones
do not:
The type annotations on the component callbacks are also wrong: declared
var: core.BNDataVariable, actually receiveLP_BNDataVariable. The working onescorrectly declare
core.BNDataVariableHandle.FIX:
var -> var[0]at lines 1481 and 1491; correct the annotations.REPRODUCE (no plugin needed):
load any binary, register a
BinaryDataNotificationimplementingcomponent_data_var_added, thenbv.create_component()andcomponent.add_data_variable(dv).