bug: Python ImageBuf.get_pixels(oiio.UNKNOWN) returns None silently or segfaults
I maintainer di solito rispondono entro 3 giorni
@stevwya77 ci sta già lavorando.
Dal 19/11/2026.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Start by reading the Python binding and C++ implementation for ImageBuf.get_pixels(), then reproduce the in-memory and lazy file-backed cases from the issue with oiio.UNKNOWN. Check how the method handles an unknown pixel type and whether its return or error behavior differs from ImageBuf.read(); done means it either uses the buffer’s native type or raises an exception, with no silent None or crash.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
From Python, ImageBuf.get_pixels(oiio.UNKNOWN) misbehaves in two ways
depending on the buffer:
- On in-memory buffers, and on a small file-backed buffer, it returns
Nonewith no exception and no error set (ImageBuf.geterror()and
oiio.geterror()are both empty). - On a file-backed buffer opened in a fresh process with no
read(), it segfaulted in 10 of 10 runs.
get_pixels() with no argument and get_pixels(oiio.HALF) work on all the same buffers.
OIIO version and dependencies
OpenImageIO 3.2.2.0 from the PyPI wheel (pip install OpenImageIO),
numpy 2.2.6, Python 3.10.7, macOS 27.2.1 arm64.
OIIO 3.2.2.0 | MacOS/ARM
Build compiler: Apple clang 17.0 | C++17/201703
HW features enabled at build: neon
No CUDA support (disabled / unavailable at build time)
Dependencies: BZip2 1.0.8, DCMTK NONE, expat 2.7.1, FFmpeg NONE, fmt 12.1.0, Freetype 2.14.3, GIF 5.2.1, Imath 3.2.3, JPEG 80, JXL 0.12.0, libdeflate 1.23, libdeflate 1.23, Libheif NONE, libjpeg-turbo 3.1.2, LibRaw NONE, libuhdr 2.0.2, minizip-ng 4.0.10, nanobind 3.1.0, OpenColorIO 2.5.1, OpenCV NONE, OpenEXR 3.5.2, OpenGL, OpenJPEG 2.5.4, openjph 0.32.0, PNG 1.6.58, Ptex NONE, Ptex NONE, pystring, Python3 3.10.11, Qt5 NONE, Qt6 NONE, Robinmap 1.4.1, TBB NONE, TIFF 4.7.1, WebP 1.6.0, yaml-cpp 0.8.0, ZLIB 1.2.12, ZLIB 1.2.12, zstd 1.5.7, zstd 1.5.7, zstd 1.5.7
To reproduce
Python only, no oiiotool equivalent.
Smallest case (returns None, no error):
import OpenImageIO as oiio
b = oiio.ImageBuf(oiio.ImageSpec(4, 4, 3, oiio.HALF))
print(b.get_pixels(oiio.UNKNOWN), repr(b.geterror())) # None ''
Crashing case:
import OpenImageIO as oiio
# Step 1: write the file (one process)
b = oiio.ImageBuf(oiio.ImageSpec(2048, 2048, 4, oiio.HALF))
oiio.ImageBufAlgo.zero(b); b.write('big.exr')
Then run step 2 in a new Python process:
import OpenImageIO as oiio
# Step 2: in a NEW Python process, read it lazily
oiio.ImageBuf('big.exr').get_pixels(oiio.UNKNOWN) # SIGSEGV, 10 of 10 runs
Eight cases, each run in its own process, first with the stock allocator
and then under guard-malloc: probe.py.
Evidence
Output:
OIIO 3.2.2.0
== normal malloc ==
[ exit 0] 1 small in-memory, UNKNOWN
-> NoneType | err: -
[ exit 0] 2 big in-memory, UNKNOWN
-> NoneType | err: -
[ exit 0] 3 small lazy file, UNKNOWN
-> NoneType | err: -
[killed by SIGSEGV (11)] 4 big lazy file, UNKNOWN
Fatal Python error: Segmentation fault
Thread 0x00000001f8d25300 (most recent call first):
File "<string>", line 3 in <module>
[ exit 0] 5 control: write then read, no UNKNOWN
-> True -
[ exit 0] 6 small UNKNOWN, then read a file
-> True -
[ exit 0] 7 small UNKNOWN, then a large allocation
-> alloc ok
[ exit 0] 8 control: small HALF, then read a file
-> True -
== guard malloc (MallocGuardEdges + MallocScribble) ==
[ exit 0] 1 small in-memory, UNKNOWN
-> NoneType | err: -
[killed by SIGSEGV (11)] 2 big in-memory, UNKNOWN
Fatal Python error: Segmentation fault
Current thread 0x00000001f8d25300 (most recent call first):
File "<string>", line 3 in <module>
[ exit 0] 3 small lazy file, UNKNOWN
-> NoneType | err: -
[killed by SIGSEGV (11)] 4 big lazy file, UNKNOWN
Fatal Python error: Segmentation fault
Current thread 0x00000001f8d25300 (most recent call first):
File "<string>", line 3 in <module>
[ exit 0] 5 control: write then read, no UNKNOWN
-> True -
[ exit 0] 6 small UNKNOWN, then read a file
-> True -
[ exit 0] 7 small UNKNOWN, then a large allocation
-> alloc ok
[ exit 0] 8 control: small HALF, then read a file
-> True -
Expected behavior
Either treat UNKNOWN as the buffer's native pixel type (the convention
ImageBuf.read() uses for its convert argument) or raise a Python
exception. It should never return None without an error, and never crash.
Found while writing a reproduction for #4613.
- Lingua principale
- C++
- Stelle
- 2.4k
- Fork
- 727
- Merge medio
- 4g 8h
- PR unite (30g)
- 67
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 AcademySoftwareFoundation/OpenImageIO
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
AcademySoftwareFoundation/OpenImageIO#5619 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
AcademySoftwareFoundation/OpenImageIO#5570 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
AcademySoftwareFoundation/OpenImageIO#5558 ·
I maintainer di solito rispondono entro 3 giorni
-
define which color metadata OpenImageIO trusts, and when it resolves itForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
AcademySoftwareFoundation/OpenImageIO#5516 ·
I maintainer di solito rispondono entro 3 giorni
-
recognize configured color spaces and report their primaries and gammaForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
AcademySoftwareFoundation/OpenImageIO#5514 ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di AcademySoftwareFoundation/OpenImageIO
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mw00/project-maya#1368 ·
I maintainer di solito rispondono entro 2 giorni
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[LLK][QSR][PERF] eltwise_binary: perf harness INIT enables direct indexing, production does notAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
tenstorrent/tt-metal#67662 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
maplibre/maplibre-native#5159 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement question
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
lbr-stack/lbr_fri_ros2_stack#420 · 1 commento ·