Potential soundness issue in `bitpacking` 0.9.3
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
Direzione di ricerca
Start with the safe wrappers in src/bitpacker1x.rs:161 and the unsafe implementation in src/macros_simple.rs:424-438. Run the provided short-slice reproducer under Miri, then inspect the corresponding sorted variants. Done means the public sorted APIs reject invalid block lengths or otherwise avoid undefined behavior, with the reproducer no longer reporting the dangling-pointer access.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hello, and thank you for maintaining this crate.
I found a sanitizer/Miri failure reachable through public crate APIs using safe Rust code. I may be missing crate-specific preconditions, but the behavior looks worth checking because safe callers should not be able to trigger undefined behavior.
Summary
- Crate:
bitpacking - Version tested:
0.9.3 - API paths with similar failures observed:
BitPacker1x::num_bits_sortedBitPacker1x::num_bits_strictly_sortedBitPacker4x::num_bits_sortedBitPacker4x::num_bits_strictly_sorted
Observed diagnostics
Miri undefined behavior: error: Undefined Behavior: memory access failed: attempting to access 4 bytes, but got 0x4[noalloc] which is a dangling pointer (it has no provenance)
Reproduction
The snippets below are minimal readable reproducers. Each PoC also includes the source location most relevant to the reported failure.
PoC 1: test_bitpacking3::generated_test_3
Relevant source location:
src/bitpacker1x.rs:161: the safe wrapper callsUnsafeBitPackerImpl::num_bits_sorted.src/macros_simple.rs:424-438: the unsafe implementation loads a full fixed block fromdecompressed.
Readable equivalent PoC:
use bitpacking::{BitPacker, BitPacker1x};
#[test]
fn poc() {
let packer = BitPacker1x::new();
let short_block: Vec<u32> = Vec::new();
let _ = packer.num_bits_sorted(0, &short_block);
}
Observed diagnostic:
error: Undefined Behavior: memory access failed: attempting to access 4 bytes, but got 0x4[noalloc] which is a dangling pointer (it has no provenance)
Source review and suggested fix
Brief reasoning:
- The public
num_bitspath already checks for the exact block length. - The sorted variants skip that check and still load a full block from the slice.
- That makes the length precondition caller-visible through a safe API.
Suggested fix:
- Validate the exact block length before calling the unsafe routine, or make the precondition explicit in an
unsafeAPI.
Thanks again for taking a look.
- Lingua principale
- Rust
- Stelle
- 346
- Fork
- 37
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 quickwit-oss/bitpacking
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
quickwit-oss/bitpacking#60 ·
-
Remove simd bitpacking implementations for high bit widthForse di nuovo libera @trinity-1686a l’ha presa 1172 giorni fa e non c’è nessuna pull request aperta. Apertagood first issue
quickwit-oss/bitpacking#47 · 2 commenti · 1 assegnatario ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
quickwit-oss/bitpacking#44 · 2 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
quickwit-oss/bitpacking#21 · 6 commenti ·
-
Hacktoberfest
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
quickwit-oss/bitpacking#20 · 2 commenti ·
Tutte le issue di quickwit-oss/bitpacking
Issue simili
-
[M09] Silence parser misreads ffmpeg times in scientific notation (6.25e-05 → 6.25 s)Forse già presa @G-darshan-32 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
clipy-recorder/clipy#164 · 1 commento ·
-
p2 ready-mac
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
quickwit-oss/tantivy#3299 ·
I maintainer di solito rispondono entro 1 giorno
-
P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
arcships/dim#2294 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
`stream enable` fails with "already enabled" on every fresh session since streaming became always-onAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
vercel-labs/agent-browser#2797 ·
I maintainer di solito rispondono entro 1 giorno