Vision: valid interlaced, 16-bit and low-bit grayscale PNGs are rejected

Aperta
#1,132 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Start by reading third_party/iris/png.h and the existing image-decoding coverage in tests/test_image_decode.c. Run the current tests, then review the listed PNG variants and the proposed fixture approach with the maintainers before choosing the supported scope. Done means the agreed valid PNG cases decode successfully with regression checks, or receive clearer client-facing errors if support remains out of scope.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ds4_image_decode_memory() returns "invalid or unsupported PNG image" for several kinds of valid PNG, because third_party/iris/png.h accepts only non-interlaced 8-bit images (plus palette images at 1/2/4/8 bits):

  • interlaced (Adam7) images: png_load_mem() fails when the IHDR interlace byte is not 0
  • 16-bit images of any color type (gray, gray+alpha, RGB, RGBA): bit_depth != 8 fails
  • grayscale at 1, 2 or 4 bits, which is common for scanned documents: the same check

The HF preprocessing these models are compared against loads images with PIL, which decodes all of these. Interlaced PNGs still show up on the web, and 16-bit PNGs come out of some screenshot and scientific tools. Today a client sending one gets an error, not a description of the image.

Repro, with no model: generate the images with Python's zlib and decode them with png_load() (the generator is 30 lines, happy to attach it):

rgb8.png         decoded
rgb8_adam7.png   REJECTED
rgb16.png        REJECTED
gray1.png        REJECTED
gray16.png       REJECTED
rgba16.png       REJECTED

The decoder fails closed, so this is not a safety problem. It is missing support, and the "unsupported" wording suggests the limit may be deliberate. Before writing anything: would you take a PR that adds Adam7 deinterlacing, 16-to-8-bit reduction and 1/2/4-bit grayscale expansion to png.h, with generated fixtures and checks in tests/test_image_decode.c like the JPEG ones? If you'd rather keep the decoder small, a clearer error ("interlaced PNG is not supported") would also help clients.

Written by Claude Code (AI assistant) on behalf of @namespaceMarcello, who directs this work.

Lingua principale
C
Stelle
24.4k
Fork
2.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di antirez/ds4

Tutte le issue di antirez/ds4

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.