component data variable notifications raise AttributeError

未关闭 适合新手
#8,444 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
python

调研方向

打开 binaryninja/binaryview.py,将第 1481 行和第 1491 行附近的组件回调与第 1171–1183 行附近正常工作的数据变量回调进行比较。使用 BinaryDataNotification、bv.create_component() 和 component.add_data_variable(dv) 进行复现;完成的标准是两个组件回调都能正确处理指针,并且其注解与接收到的句柄类型匹配。

由索引模型根据 Issue 内容生成。

描述

_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).

主要语言
C++
星标
1.3k
派生
298
平均合并
5 天 5 小时
30 天内合并 PR
19

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Vector35/binaryninja-api 的其他 Issue

查看 Vector35/binaryninja-api 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。