Multi-frame loaders in this Python imaging library can retain an ImagingCore allocation created for a narrow frame mode. When a subsequent frame of the same dimensions changes the logical mode and decoder tiles to wider RGB or CMYK data, the `ImageFile.load prepare()` function reuses the stale native storage because the ` im` variable is non-null, without verifying if the mode and size still match. This allows crafted PSD, MPO, DCX, or MIC frame transitions to write wider pixels into the narrow allocation, leading to native out-of-bounds writes and crashes. Additionally, the MPO path can cause a native over-read, which may lead to command execution in specific runtime profiles.