Skip to content

[BUG] CMYK jpg to regular jpg is broken #4962

@joshyoo-topazlabs

Description

@joshyoo-topazlabs

Describe the bug

cmyk_to_rgb() seems to be broken in the 3.1.6.0 and 3.1.7.0 versions(possibly others as well). I noticed when using openimageio within a project, and I was able to reproduce the issue using oiiotool. This does NOT happen with an older versions such as 3.0.10.1. I was able to verify that this happens when building from source, and on both windows and mac.

I am specifically testing by importing a cmyk jpg image, and outputting a regular jpg.

OpenImageIO version and dependencies

OIIO 3.1.6.2 | 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.6.4, FFmpeg NONE, fmt 10.2.1, Freetype 2.13.3, GIF NONE, Imath 3.1.12, JXL NONE, Libheif 1.19.8, libjpeg-turbo 3.1.0, LibRaw 0.21.3, libuhdr 1.4.0, minizip-ng 4.0.7, OpenColorIO 2.4.2, OpenCV NONE, OpenEXR 3.2.4, OpenGL, OpenJPEG 2.5.3, openjph 0.23.1, PNG 1.6.47, Ptex NONE, Ptex NONE, pybind11 3.0.1, pystring, Python3 3.13.3, Qt5 NONE, Qt6 NONE, Robinmap 1.4.0, TBB NONE, TIFF 4.7.0, WebP 1.6.0, yaml-cpp 0.8.0, ZLIB 1.3.1, ZLIB 1.3.1

To Reproduce

  1. run make

  2. use oiiotool to import a cmyk .jpg image then output a .jpg
    ./oiiotool ./CMYK.jpg --resize 640x420 -o ./cmyk-to-rgb-jpg.jpg

Evidence

-- Error message
[1] 25028 bus error ./oiiotool --resize 640x420 -o

-- Debug
Process 25077 launched: '.../OpenImageIO/build/bin/oiiotool' (arm64) Process 25077 stopped thread #11, stop reason = EXC_BAD_ACCESS (code=2, address=0x170378000) frame #0: 0x00000001014f2484 libOpenImageIO.3.1.dylibOpenImageIO::v3_1::cmyk_to_rgb(int, unsigned char const*, unsigned long, unsigned char*, unsigned long) + 880
libOpenImageIO.3.1.dylibOpenImageIO::v3_1::cmyk_to_rgb: -> 0x1014f2484 <+880>: ld4.16b { v17, v18, v19, v20 }, [x14], #64 0x1014f2488 <+884>: tbl.16b v21, { v17 }, v0 0x1014f248c <+888>: tbl.16b v22, { v17 }, v1 0x1014f2490 <+892>: tbl.16b v23, { v17 }, v3

Sample Data
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions