Object::clone, Repository::config and Repository::index can wrap libgit2 reference counts
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start by tracing Object::clone, Repository::config and Repository::index in git2-rs to the bundled libgit2 reference count increments described in the report. The issue asks for checks on those increments; the payload does not name the bundled source files or tests. Done means the three reproductions no longer allow reference counts to wrap and the reported use-after-free paths are addressed.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
libgit2 1.9.7, which libgit2-sys bundles, keeps reference counts in a 32-bit atomic int and does not check them before incrementing.
Object::clone calls git_object_dup. With one handle, one surviving clone and the reference held by libgit2's object cache, forgetting 2^32 - 2 further clones (std::mem::forget is safe) and dropping the original frees the object. The surviving handle's next call, Object::kind, reads freed memory.
Repository::config() and Repository::index() return the repository's cached config or index with its count incremented. GIT_REFCOUNT_DEC frees when the decremented count is <= 0 and the owner pointer is null, so 2^31 - 1 forgotten handles are enough. Dropping the Repository then frees the config or index while a Config or Index handle remains.
We ran all three paths with git2 0.21.0 (bundled libgit2 1.9.7) and a program with no unsafe code. AddressSanitizer reports a heap use-after-free in Object::kind, Config::get_string and Index::len. We reported this to libgit2 privately and have had no reply. Could you patch the bundled libgit2 to check these increments?
- 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à 3/5 1-2 giorni Idoneità per principianti 64/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