Unsound usages of unsafe implementation about c_void
まだ誰も着手していません。
- 主要言語
- Rust
- スター
- 28
- フォーク
- 11
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi, I am scanning this crate in the latest version using my own static analyzer tool.
Unsafe pointer conversion is found at: src/netmap_user.rs:16
pub unsafe fn _NETMAP_OFFSET<T, U>(ptr: *mut U, offset: isize) -> *mut T {
((ptr as *mut c_char).offset(offset) as *mut c_void) as *mut T
}
This unsound implementation would create memory issues such as overflow, underflow, or misalignment, since the type is converted to c_void (1 byte, 8 bits). The attacker can manipulate the argument offset associated with the c_void pointer with a large value, as well as T and U, which can lead to a buffer overflow bug.
This would cause undefined behaviors in Rust. Adversaries can manipulate the associated arguments to cause memory safety bugs. I am reporting this issue for your attention.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/netmap_user.rs:16 と _NETMAP_OFFSET 関数から始め、続いて raw-pointer offset、アラインメント、境界に関する Rust の未定義動作の要件を確認してください。関数の呼び出し元と照合して static-analyzer のレポートを検証し、報告された変換によって主張されているメモリ安全性の問題が発生し得るかどうかを判断してください。調査結果が明確に解決され、適切に検証されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- networking
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100