qoi_decode accepts truncated/no-chunk QOI streams and can allocate large output buffers from tiny files
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- c
- Ambito
- computer-graphics, security
Direzione di ricerca
Start at the qoi_decode() and qoi_read() entry points, then run the attached README, PoCs, and reproduction scripts against the no-chunk and truncated examples. Done means malformed streams with insufficient data are rejected with NULL and tiny invalid files do not trigger allocation of the declared full output buffer.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
I found that qoi_decode() / qoi_read() can accept malformed QOI streams that do not contain enough image data to produce the declared number of pixels.
In these cases, the decoder returns success instead of rejecting the input as invalid. This can also allow very small .qoi files to trigger allocation of a much larger output buffer based only on the declared dimensions.
I am reporting this as a decoder correctness and resource-amplification hardening issue, not as memory corruption. I did not observe an ASan/libFuzzer memory-corruption crash.
Affected version tested
I tested the current master branch:
commit: 97bacc86a9c4abf5a2d452102dc26546c4c670b9
I did not find a direct phoboslab/qoi OSS-Fuzz project in my current google/oss-fuzz/projects checkout.
Observed behavior
The decoder accepts inputs that contain a valid QOI header but do not contain enough chunks to encode the declared pixels.
Examples:
no_chunks_1x1.qoi
size: 22 bytes
qoi_read(): decode=ok
truncated_rgba_2x1.qoi
size: 23 bytes
qoi_read(): decode=ok
no_chunks_20000000x1_rgba.qoi
size: 22 bytes
qoi_read(): decode=ok
observed RSS: about 80 MB in my local test
The last case is a 22-byte input that declares a large image and causes the decoder to allocate the full output buffer even though the file contains no actual pixel chunks.
Expected behavior
Malformed QOI streams that do not provide enough data for the declared image dimensions should be rejected.
The API documentation says:
Returns NULL if something went wrong.
I would expect truncated/no-chunk streams to return NULL rather than being accepted as successfully decoded images.
Impact
This can lead to surprising successful decoding of invalid QOI data and allows small files to trigger much larger memory allocations based on declared dimensions.
I did not observe a memory-safety crash, so this should be treated as a correctness/resource-amplification issue rather than a code execution issue.
Reproduction package
I attached a minimal reproduction package without binaries:
qoi-maintainer-repro_public_minimal.zip
SHA-256: A250578ABDFDCEC2EDCB3A965A411E10FDD427659ACB22ED67E9573C7603D8B3
The package contains:
README
PoCs
reproduction scripts
logs
fuzzing summary
suggested validation direction
SHA256SUMS.txt
I can provide the full reproduction package with convenience binaries if useful.
- Lingua principale
- C
- Stelle
- 7.6k
- Fork
- 383
- 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 phoboslab/qoi
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
-
Lossy QOI encoder in PythonAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Implementation in uxnAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
QOI grey scale palette.Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 25/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
Tutte le issue di phoboslab/qoi
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
fastfetch-cli/fastfetch#2780 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
elliotchance/vsql#2079 ·
I maintainer di solito rispondono entro 1 giorno
-
[libcbor] update to 0.15.1Apertacategory:port-update
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 2 giorni
-
docs
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 70/100
meshcore-dev/MeshCore#4015 ·
I maintainer di solito rispondono entro 2 giorni