[BUG] Heap buffer overflow: calling `Repository::find_submodule("/")` → 1-byte read before heap buffer
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 64/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Rust
- Stelle
- 2.1k
- Fork
- 470
- Merge medio
- 2g 17h
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rust-lang/git2-rs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 messageForse già presa @shivampwm2020 l’ha presa 43 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rust-lang/git2-rs
Issue simili
-
bug P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Windows microphone listing treats words in a device name as DirectShow labelsForse già presa @Sujal-chaudhary l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
clipy-recorder/clipy#447 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
nightly-cleanup
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
max-sixty/worktrunk#4939 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursApertaflaky
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
stacks-network/stacks-core#7918 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni