[BUG] Heap buffer overflow: calling `Repository::find_submodule("/")` → 1-byte read before heap buffer
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 64/100
調査の方向性
The report points to Repository::find_submodule and libgit2’s git_submodule__lookup_with_cache; start by tracing how the / path is handled in that lookup. Reproduce with the provided Rust program and AddressSanitizer command. Done when the call no longer triggers the reported heap-buffer-overflow and the regression is covered by a test.
索引モデルが issue の本文から書いたものです。
説明
Can be triggered on the latest commit b9d59b6 (git2, vendored-libgit2 feature), from rust safe code (#![forbid(unsafe_code)]).
Summary
Running the program below prints the following and aborts with a heap-buffer-overflow:
calling find_submodule("/")
==ERROR: AddressSanitizer: heap-buffer-overflow READ of size 1
#0 git_submodule__lookup_with_cache
#1 git_submodule_lookup
#2 <git2::repo::Repository>::find_submodule
#3 10r::main
is located 1 bytes before 8-byte region
allocated by thread T0 here:
#0 realloc
#6 git_str_puts
#7 git_submodule__lookup_with_cache
#8 git_submodule_lookup
#9 <git2::repo::Repository>::find_submodule
Calling repo.find_submodule("/") on the initialized repository allocates an 8-byte buffer during find_submodule and reads 1 byte before the start of that allocation.
Reproduce
Cargo.toml:
[dependencies]
git2 = { version = "0.21.0", default-features = false, features = ["vendored-libgit2"] }
src/main.rs:
#![forbid(unsafe_code)]
use git2::Repository;
use std::path::Path;
fn main() {
let dir = Path::new("tmp/git2-10");
let _ = std::fs::remove_dir_all(dir);
let repo = Repository::init(dir).expect("Repository::init");
eprintln!("calling find_submodule(\"/\")");
let r = repo.find_submodule("/");
eprintln!("find_submodule -> {:?}", r.err());
let _ = std::fs::remove_dir_all(dir);
}
CFLAGS="-fsanitize=address" RUSTFLAGS="-Zsanitizer=address" \
cargo +nightly run -Zbuild-std --target x86_64-unknown-linux-gnu
- 主要言語
- Rust
- スター
- 2.1k
- フォーク
- 470
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 18
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rust-lang/git2-rs のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 message対応中かも @shivampwm2020 が 43 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
rust-lang/git2-rs の issue をすべて見る
似ている issue
-
bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
Windows microphone listing treats words in a device name as DirectShow labels対応中かも @Sujal-chaudhary が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
clipy-recorder/clipy#447 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
nightly-cleanup
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
max-sixty/worktrunk#4939 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursオープンflaky
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
stacks-network/stacks-core#7918 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信