MSP430: byte operations sign-extend into registers instead of zero-extending
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
Start in arch/msp430/src/lift.rs and inspect the byte-handling arms, including Instruction::Mov, where the issue identifies il.sx(2, ...) as suspect. Load sx_repro.bin or use the provided printf command, then compare LLIL at offset 0 and the resulting HLIL value against the documented zero-extension behavior. Done means byte register operations produce 0x80 + arg1 rather than 0xff80 + arg1.
索引モデルが issue の本文から書いたものです。
説明
Version and Platform (required):
- Binary Ninja Version: 5.0.7648
- Edition: Non-Commercial
- OS: Ubuntu
- OS Version: 24.04
- CPU Architecture: x64
Bug Description:
A byte instruction with a register destination is lifted with a sign-extension. Per slau144 §3.2.5, Figure 3-7 (Byte-Register Operation), the high byte of the destination register is filled with 0h — byte operations zero-extend into registers.
The result is an incorrect constant in HLIL for any byte value with bit 7 set.
Steps To Reproduce:
printf '\x7b\x40\x80\x00\x0f\x5b\x30\x41' > sx_repro.bin or open sx_repro.bin attached and look at sub_0 (if sub_0 does not exist, create a function at 0).
Expected Behavior:
The returned value should be 0x80 + arg1 and not 0xff80 + arg1.
LLIL at offset 0 should not sign-extend.
Confirmed against the mspdebug simulator (v0.22): with r11 = 0xdead and r15 = 0x1234 set beforehand, mov.b #0x80, r11 leaves r11 = 0x0080. The subsequent add r11, r15 gives 0x12b4.
Screenshots/Video Recording:
Binary:
sx_repro.zip
Suspected cause (hypothesis):
The byte arms in arch/msp430/src/lift.rs use il.sx(2, ...) where il.zx(2, ...) is required — e.g. in Instruction::Mov:
OperandWidth::Byte => il
.sx(2, lift_source_operand(inst.source(), size, il))
.build()
This appears in several instruction arms, so the fix is likely needed in more than one place.
- 主要言語
- C++
- スター
- 1.3k
- フォーク
- 298
- 平均マージ
- 4日 13時間
- マージ済み PR(30日)
- 20
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Vector35/binaryninja-api のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
Vector35/binaryninja-api#8540 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Vector35/binaryninja-api#8446 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Vector35/binaryninja-api#8444 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Vector35/binaryninja-api#8441 · コメント 3 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Vector35/binaryninja-api#8404 ·
Vector35/binaryninja-api の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
google/libultrahdr#485 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
godotengine/godot#123776 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 60/100
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ros2/common_interfaces#344 ·