This vulnerability in OpenImageIO's PSD reader stems from a mismatch between the channel count advertised in the image specification and the actual data present in the channel buffers. When reading an indexed-color PSD file that includes transparency metadata, and when either the oiio:rawcolor or psd:rawdata option is enabled, spec.nchannels reports more channels than were actually allocated in channel_buffers. The standard read path handles this edge case through normalization logic that was incrementally added as the handler matured. The raw-color mode—which exists specifically for workflows requiring exact Photoshop channel layouts—bypasses that normalization, operating on the assumption that users want 'exactly what Photoshop wrote.' For indexed PSDs with transparency, that assumption was always unsafe for this edge case.

The practical risk extends beyond a crash from out-of-bounds reads. Tools that trust the specification's channel count to allocate buffers downstream could experience heap corruption without an immediate crash, silently propagating malformed data. This is particularly concerning because the raw-color mode is typically enabled by color scientists, DI houses, and archival workflows that require channel-accurate data for compliance or forensic purposes—precisely the pipelines least likely to suspect the input when results appear wrong.

This pattern mirrors documented vulnerabilities in other image libraries (libpng colormap handling, libtiff CCITT regressions), where opt-in raw-access modes create parallel code paths that don't inherit the cumulative edge-case handling added to their normalized counterparts over time. The PSD format's channel model—layer masks, alpha channels, indexed color channels—is unusually complex, making this the most visible instance, but the structural gap likely exists in other format handlers that expose raw-color options.

The remediation is the immediate patch to normalize the raw-color path or reject the unsupported combination, but the architectural question is whether raw-color modes should guarantee the same normalization safety as standard reads, or explicitly document that they expose unsafe internal state for certain input variants.