Skip to content
Memory corruption Advisory Advanced CVE-2026-87638

Out of bounds write in Media (CVE-2026-87638)

The H.265 hardware decoder on macOS only rebuilds its format description on keyframes, so a changed sequence parameter set that alters coding tree block size on a non-keyframe leaves a stale format in place. A crafted stream could then make the decoder address blocks beyond the session's configured limits, potentially causing an out-of-bounds memory access in the GPU process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 43 days

Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential synchronization issue in VideoToolboxH265Accelerator allows a stale CMVideoFormatDescription to be reused when Coding Tree Block (CTB) size changes on a non-IRAP frame. This occurs because format description regeneration is skipped for non-IRAP frames, even when a changed Sequence Parameter Set (SPS) is detected. Consequently, Apple's hardware decoder may decode slices with addresses exceeding the session's originally configured limits, potentially leading to out-of-bounds memory access in the macOS GPU process.

Affected files:

  • media/gpu/mac/video_toolbox_h265_accelerator.cc
  • media/gpu/h265_decoder.cc
  • media/parsers/h265_parser.cc
  • media/gpu/mac/video_toolbox_decompression_session_manager.mm

Estimated timestamp from git blame: 2023-09-20

Root Cause Analysis

In media/gpu/mac/video_toolbox_h265_accelerator.cc, SubmitDecode() only rebuilds the CMVideoFormatDescription format description (active_format_) on IRAP (keyframe) frames, even after detecting that the active SPS bytes have changed:

C++
// media/gpu/mac/video_toolbox_h265_accelerator.cc:274-279
if (!active_format_ || (combined_nalu_data.size() && frame_is_keyframe_)) {
  combined_nalu_data.clear();
  if (!CreateFormat(pic)) {
    return Status::kFail;
  }
}

frame_is_keyframe_ is set from slice_hdr->irap_pic at line 182. The assumption that configuration changes can only occur at keyframes is enforced by H265Decoder::ProcessPPS() for some SPS fields, but not all:

C++
// media/gpu/h265_decoder.cc:657-668
const bool is_config_change =
    pic_size_ != new_pic_size || dpb_.max_num_pics() != sps->max_dpb_size ||
    profile_ != new_profile || bit_depth_ != new_bit_depth ||
    chroma_sampling_ != new_chroma_sampling;

if (is_config_change) {
  // Only color space changes are allowed on non-IRAP pictures.
  if (curr_slice_hdr_ && !curr_slice_hdr_->irap_pic && !first_picture_) {
    DVLOG(1) << "A configuration change on a non-IRAP picture is not allowed.";
    return false;
  }
}

Importantly, ctb_log2_size_y / pic_size_in_ctbs_y are not checked by is_config_change. Two SPSes with identical dimensions, profile, bit-depth, and chroma sampling, but differing log2_min_luma_coding_block_size_minus3 or log2_diff_max_min_luma_coding_block_size can bypass this check on a non-IRAP frame without triggering a configuration change in H265Decoder.

Potential Trigger Path

(Note: These are potential steps as our tooling does not currently have runtime execution capabilities.)

  1. Stream Setup: The attacker serves an HEVC Annex-B stream containing two distinct SPS blocks sharing sps_id = 0:
    • SPS_A: Configured with a resolution of 1024x1024, ctb_log2_size_y = 6 (CTB size 64x64), resulting in pic_size_in_ctbs_y = 256 total CTBs.
    • SPS_B: Configured with the same resolution (1024x1024) but ctb_log2_size_y = 4 (CTB size 16x16), resulting in pic_size_in_ctbs_y = 4096 total CTBs.
  2. Initialize Session: The decoder processes an IDR (IRAP) frame utilizing SPS_A. The accelerator builds active_format_ from SPS_A, and the VideoToolboxDecompressionSessionManager instantiates a hardware decoding session optimized for a 256-CTB layout.
  3. Inject SPS_B: The stream transmits SPS_B, which overwrites sps_id = 0 in the parser's cached state.
  4. Process non-IRAP Frame: The stream presents a non-IRAP TRAIL_R slice utilizing pps_id = 0 (pointing to sps_id = 0 / SPS_B).
    • H265Decoder::ProcessPPS() computes is_config_change = false because resolution and basic profiles match, allowing decoding to proceed on the non-IRAP frame.
    • VideoToolboxH265Accelerator::SubmitFrameMetadata() marks frame_is_keyframe_ = false.
  5. Craft OOB Slice Address: The TRAIL_R picture contains a second slice segment (first_slice_segment_in_pic_flag = 0) with slice_segment_address = 4095.
    • Chromium's parser validates slice_segment_address against SPS_B's limits (pic_size_in_ctbs_y - 1 = 4095) and permits the value.
  6. State Desynchronization: Inside SubmitDecode(), ExtractChangedParameterSetData() notices that the active SPS has changed, updates active_sps_data_[0] to SPS_B, and appends SPS_B to combined_nalu_data.
    • However, because frame_is_keyframe_ is false, CreateFormat() is not called. active_format_ remains configured with the stale SPS_A properties (256 CTBs max).
  7. OOB Write: The CMSampleBuffer containing the stale active_format_ is passed to the decompression session manager. The manager bypasses regeneration because the format description pointer has not changed. The hardware/software decoder processes a slice segment targeting CTB 4095 within a session configured only for 256 CTBs, potentially leading to out-of-bounds memory access in Apple's closed-source decoder inside the macOS GPU process.

Suggested Fix

To prevent state desynchronization, VideoToolboxH265Accelerator should rebuild the CMVideoFormatDescription whenever a parameter set change is detected, regardless of whether the frame is a keyframe. This mirrors the safe behavior implemented in the H.264 sibling (VideoToolboxH264Accelerator):

C++
// media/gpu/mac/video_toolbox_h265_accelerator.cc
if (!active_format_ || combined_nalu_data.size()) {
  combined_nalu_data.clear();
  if (!CreateFormat(pic)) {
    return Status::kFail;
  }
}

Evaluated with Chrome root at commit: 94d9235ebe3b7276e5284f0dc5d55577ff949908


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there's no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the accelerator rebuilds the format description only for keyframes, and the decoder's configuration-change check omits coding tree block size fields, so a changed SPS on a non-keyframe is accepted while the stale format is reused.

Impact

The hardware or software decoder may process a slice targeting a block far beyond the session's configured limits, potentially leading to out-of-bounds memory access in Apple's closed-source decoder inside the macOS GPU process.

What the attacker needed

Victim plays a crafted HEVC video; macOS with hardware H.265 decoding

The fix

The accelerator should rebuild the format description whenever a parameter set change is detected, regardless of whether the frame is a keyframe.

How it was found

  1. Serve an HEVC stream with two SPS blocks sharing the same id, differing only in coding tree block size.
  2. Decode an IDR frame using the first SPS so the session is built for the smaller block count.
  3. Send the second SPS, overwriting the cached parameter set.
  4. Send a non-keyframe slice using the second SPS, which passes the configuration-change check.
  5. Include a second slice segment with a block address valid only under the new SPS.
  6. The stale format is passed to the decoder, which processes the out-of-range block address.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Video is split into frames, and some frames are 'keyframes' that carry full setup information while others only carry changes. The decoder here only refreshes its setup on keyframes, so if a later frame quietly changes a size setting, the decoder keeps using the old limits. A malicious video could then point at a block number that does not exist in the old setup, which may corrupt memory.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.