Validate instruction addresses and memory bounds in the emulator
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp
調査の方向性
issueで特定された命令デコードループがある emulator/main.c から始めてください。メモリ読み取りの前に、BASE、命令値、計算されたアドレスがどのように使われるかを追い、その後、エミュレーターの既存のビルドまたは実行手順を確認してください。不正なベース、アドレス、命令が説明的なエラーとともに安全に停止し、有効なプログラムは引き続き動作すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
The emulator derives memory addresses from instruction values without validating them, which can read beyond the allocated memory and crash or corrupt state.
Problem
The code computes address = memory[i] % BASE and reads memory[address] for every instruction. If the program or base value is malformed, address may be outside the bounds of the memory array. Similarly, the instruction stream itself is not validated before decoding.
Expected behavior
- Check
BASEandaddressranges before reading memory. - Reject instructions that are invalid for the current architecture.
- Stop safely with a descriptive error on malformed programs.
Relevant code
emulator/main.cin theforloop that decodes instructions and accesses memory.
Suggested fix
Add range checks before each memory read and each address calculation. Reject BASE <= 0 and guard memory accesses with 0 <= address && address < MEMORY_SIZE before dereferencing them. Report invalid instructions instead of falling through to undefined behavior.
- 主要言語
- C++
- スター
- 0
- フォーク
- 0
- 平均マージ
- 1分
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DavidSkillman/LittleManCompiler のほかの issue
-
bug copilot enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
bug compiler copilot good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
DavidSkillman/LittleManCompiler の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
ROCm/rocm-systems#15475 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
Sendspin/sendspin-cpp#257 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
pocoproject/poco#5664 ·
メンテナーはふだん 2 日以内に返信
-
community:good-first-issue kind:bug kind:test scope:control status:needs-triage vehicle:rover
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
PX4/PX4-Autopilot#29727 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信