component data variable notifications raise AttributeError

オープン 初心者向け
#8,444 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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時間
マージ済み PR(30日)
19

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Vector35/binaryninja-api のほかの issue

Vector35/binaryninja-api の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。