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

Improper input validation in Media (CVE-2026-78900)

The H.264 bitstream parser fails to bound the long_term_frame_idx field, allowing an attacker to supply a large integer that is passed unvalidated to hardware video decoding drivers. This could cause out-of-bounds memory accesses in the sandboxed GPU process or kernel-level drivers.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 38 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: The H.264 bitstream parser lacks a bounds check for the long_term_frame_idx field when parsing memory management control operations. This allows an attacker-controlled, unvalidated large integer to propagate directly into bounds-bearing hardware-decode driver structures. Processing these structures can result in potential out-of-bounds memory accesses in the sandboxed GPU process or kernel-level drivers.

Affected files:

  • media/parsers/h264_parser.cc
  • media/gpu/h264_decoder.cc
  • media/gpu/windows/d3d11_h264_accelerator.cc
  • media/gpu/v4l2/v4l2_video_decoder_delegate_h264.cc

Estimated timestamp from git blame: 2012-05-14

1. Summary of the Issue (Meant for Human Triage)

A potential high-severity security vulnerability has been identified in Chromium's H.264 bitstream parser and hardware accelerator decoder delegates. An unvalidated bitstream field is propagated directly to hardware-accelerated video decoding driver APIs without bounds checking.

Specifically, the H.264 slice-header field dec_ref_pic_marking().long_term_frame_idx (per ITU-T H.264 §7.4.3.3) is parsed using READ_UE_OR_RETURN without any subsequent range-bounding check (such as IN_RANGE_OR_RETURN). Under the H.264 specification, this field must be bounded within [0, MaxLongTermFrameIdx], where MaxLongTermFrameIdx is at most 15. However, the parser accepts values up to 0x7FFFFFFF.

This unvalidated value is stored verbatim in the reference H264Picture objects inside the Decoded Picture Buffer (DPB). During frame submission, the accelerator delegates read this value and pass it directly to the OS-level hardware video decoding APIs:

  • On Windows (D3D11 / DXVA): It is narrow-cast to a USHORT (allowing control up to 0xFFFF) and copied into the DXVA_PicParams_H264.FrameNumList array, which is then submitted via ID3D11VideoContext::SubmitDecoderBuffers.
  • On ChromeOS (V4L2): The full, un-narrowed 31-bit value is stored as a __u32 inside v4l2_h264_dpb_entry.pic_num and sent to stateless hardware video decoding kernel drivers via ioctl(VIDIOC_S_EXT_CTRLS, V4L2_CID_STATELESS_H264_DECODE_PARAMS).

Because the downstream proprietary GPU and kernel drivers rely on these fields for indexing internally managed reference picture tables, passing unchecked, out-of-bounds indices from sandboxed user-space processes exposes a severe risk of driver-level or kernel-level memory corruption.

Note: The steps provided below are potential suggested steps; our tooling agent does not yet have the ability to run code or execute a live proof of concept.

2. Proof-of-Concept & Detailed Execution Flow

Below is the suggested step-by-step trace of how an attacker could potentially trigger this vulnerability, detailing the exact data flow from untrusted input to the bounds-bearing driver sink:

  1. An attacker crafts a malicious Annex-B H.264 video bitstream containing an unvalidated long_term_frame_idx value (up to 0x7FFFFFFF).
  2. The attacker delivers this video to a victim using an HTML <video> tag or the WebCodecs API (VideoDecoder.decode()).
  3. The Chromium browser or renderer process routes this bitstream to the H264Parser.
  4. In media/parsers/h264_parser.cc, the parser parses a memory management control operation (MMCO) via ParseDecRefPicMarking.
  5. If the MMCO is 3 or 6, READ_UE_OR_RETURN(&marking->long_term_frame_idx) is called (line 1356).
  6. The READ_UE_OR_RETURN macro processes an unsigned exponential-Golomb value. It limits the number of leading zeros to 31, allowing values up to 0x7FFFFFFF (media/parsers/bit_reader_macros.h).
  7. Unlike other H.264 parser fields (e.g., first_mb_in_slice at line 1433), there is no IN_RANGE_OR_RETURN macro bounding long_term_frame_idx to the specification-mandated range [0, MaxLongTermFrameIdx].
  8. This parsed slice header is passed to H264Decoder::HandleMemoryManagementOps in media/gpu/h264_decoder.cc.
  9. If MMCO is 3 (line 895) or 6 (line 943), the unvalidated ref_pic_marking->long_term_frame_idx is copied verbatim directly to the H264Picture::long_term_frame_idx field (e.g., pic->long_term_frame_idx = ref_pic_marking->long_term_frame_idx).
  10. The H264Picture object containing this tainted value resides in the Decoded Picture Buffer (dpb_).
  11. Before submitting the frame metadata to the accelerator, H264Decoder::UpdatePicNums (line 423) is called.
  12. At line 431, pic->long_term_pic_num is assigned the tainted value from pic->long_term_frame_idx.
  13. The decoder then calls SubmitFrameMetadata on the active hardware accelerator delegate.
  14. On ChromeOS (V4L2): The function V4L2VideoDecoderDelegateH264::SubmitFrameMetadata translates the DPB to the V4L2 representation (H264DPBToV4L2DPB).
  15. In media/gpu/v4l2/v4l2_video_decoder_delegate_h264.cc (lines 204-205), entry.frame_num = pic->long_term_pic_num; (narrowed to __u16) and entry.pic_num = pic->long_term_frame_idx; (preserved as a full 0x7FFFFFFF 32-bit __u32 value) are copied into the v4l2_h264_dpb_entry struct.
  16. At line 611, the priv_->v4l2_decode_param structure containing the tainted DPB is submitted to the kernel driver via ioctl(VIDIOC_S_EXT_CTRLS, V4L2_CID_STATELESS_H264_DECODE_PARAMS).
  17. The V4L2_CID_STATELESS_H264_DECODE_PARAMS bounds-bearing structure uses dpb[i].pic_num and frame_num for driver indexing, resulting in an out-of-bounds access within the kernel-space V4L2 driver.
  18. On Windows (D3D11/DXVA): The function D3D11H264Accelerator::SubmitFrameMetadata maps the DPB into the DXVA structure.
  19. In media/gpu/windows/d3d11_h264_accelerator.cc (lines 122-125), frame_num_list_[i] is set to our_ref_pic->long_term_pic_num, casting the large integer to a USHORT (up to 0xFFFF).
  20. At lines 291-292, frame_num_list_ is copied into DXVA_PicParams_H264.FrameNumList via memcpy.
  21. At line 306, params_buffer.Commit() pushes the D3D11 buffer description containing the tainted FrameNumList onto the video_buffers_ queue (ScopedD3D11DecoderBuffer::Commit).
  22. Later, when SubmitSlice is executed, the D3D11VideoDecoderWrapperImpl::SubmitDecoderBuffers() API is called (media/gpu/windows/d3d11_video_decoder_wrapper.cc:188-218).
  23. The video_context_->SubmitDecoderBuffers(...) call passes the tainted structure to the D3D11 hardware driver in the GPU process.
  24. The D3D11 hardware driver uses the out-of-bounds FrameNumList[i] value, leading to out-of-bounds memory access within the driver/GPU process.

Suggested Fix

Apply an IN_RANGE_OR_RETURN check immediately after parsing the field in media/parsers/h264_parser.cc (similar to the fix applied in b/500028989 for first_mb_in_slice). The parser should ensure the parsed long_term_frame_idx strictly bounded.

C++
        if (marking->memory_mgmnt_control_operation == 3 ||
            marking->memory_mgmnt_control_operation == 6) {
          READ_UE_OR_RETURN(&marking->long_term_frame_idx);
          // Add appropriate bounds check based on max_long_term_frame_idx_plus1
          // or absolute H.264 specification limits (e.g., 0 to 15).
          // IN_RANGE_OR_RETURN(marking->long_term_frame_idx, 0, ...);
        }

3. Technical Verification Details (Automated Audit Logs - Reviewers may skip this section)

Critic model verdict (2026-07-18 05:02:51):

  • Severity: High (S1)

  • Brief Notes / Reasoning: The report accurately identifies a missing bounds check in H.264 bitstream parsing that leads to unvalidated data reaching hardware video decode drivers.

    1. Root Cause: In media/parsers/h264_parser.cc, the dec_ref_pic_marking().long_term_frame_idx field is read via READ_UE_OR_RETURN but lacks an IN_RANGE_OR_RETURN check, allowing an attacker to supply values up to 0x7FFFFFFF. The H.264 spec max is 15.
    2. Trigger Path: H264Decoder::HandleMemoryManagementOps (media/gpu/h264_decoder.cc) copies this unvalidated value directly to H264Picture::long_term_frame_idx. UpdatePicNums() assigns it to long_term_pic_num. When SubmitFrameMetadata() is called, accelerator delegates read this tainted DPB state. In D3D11H264Accelerator, the value is cast to USHORT (giving control over the lower 16 bits) and copied into DXVA_PicParams_H264.FrameNumList. In V4L2VideoDecoderDelegateH264, it is placed into v4l2_h264_dpb_entry.pic_num as a __u32. Both are submitted directly to the OS/kernel drivers.
    3. Severity Justification (S1 / High): The knowledge base explicitly defines this exact pattern as High (S1): 'Bitstream field passed unvalidated to a HW-decode driver struct: a media/parsers/h26x_parser.cc field read via READ_UE_OR_RETURN with no IN_RANGE_OR_RETURN, copied verbatim by an accelerator delegate... into DXVA_PicParams_* / V4L2_CID_*'. The KB also explicitly notes: 'Do NOT reject for no ASAN report — the corruption is driver-side. PoC = the bad value at the delegate copy step.'
    4. Ceilings/Modifiers: The GPU process is sandboxed on Windows and ChromeOS. Android uses MediaCodecVideoDecoder and does not instantiate H264Decoder, so it is not unsandboxed (S0). Therefore, this is memory corruption in a sandboxed process, confirming the High (S1) rating despite the report's self-rating of Medium.

Prior Automated Validation Assertions:

  • Parser (no semantic bound):

    C++
    // media/parsers/h264_parser.cc:1354-1356
    if (marking->memory_mgmnt_control_operation == 3 ||
        marking->memory_mgmnt_control_operation == 6)
      READ_UE_OR_RETURN(&marking->long_term_frame_idx);
    

    READ_UE_OR_RETURN accepts up to _num_bits_processed == 31 → *out = (1u<<31)-1 = 0x7FFFFFFF. Per ITU-T H.264 §7.4.3.3 / §8.2.5.4, long_term_frame_idx must be bounded.

  • Decoder (verbatim copy, no re-check):

    C++
    // media/gpu/h264_decoder.cc:925-943  (MMCO=6)
    case 6: {
      ...
      pic->ref = true;
      pic->long_term = true;
      pic->long_term_frame_idx = ref_pic_marking->long_term_frame_idx;  // :942 — no bound
      break;
    }
    
  • D3D11 sink (§M4.8 verbatim copy):

    C++
    // media/gpu/windows/d3d11_h264_accelerator.cc:117-125
    ref_frame_list_[i].AssociatedFlag = our_ref_pic->long_term;         // = 1
    ...
    frame_num_list_[i] =
        ref_frame_list_[i].AssociatedFlag
            ? our_ref_pic->long_term_pic_num                             // 0x7FFFFFFF → USHORT narrow → 0xFFFF
            : our_ref_pic->frame_num;
    

    frame_num_list_ is USHORT[16].

  • V4L2 sink (no narrowing, full 31-bit value):

    C++
    // media/gpu/v4l2/v4l2_video_decoder_delegate_h264.cc:200-205
    struct v4l2_h264_dpb_entry& entry = priv_->v4l2_decode_param.dpb[i++];
    ...
    if (pic->long_term) {
      entry.frame_num = pic->long_term_pic_num;   // __u16 ← 0x7FFFFFFF (narrows)
      entry.pic_num   = pic->long_term_frame_idx; // __u32 ← 0x7FFFFFFF (NO narrowing)
    }
    

Evaluated with Chrome root at commit: b96d2ec58f4f5f92b540a723966b199d6e9951b4


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 parser reads the long_term_frame_idx field without applying a range check, unlike other fields, so an attacker-controlled value up to 0x7FFFFFFF reaches hardware decoder structures.

Impact

This could lead to out-of-bounds memory accesses in the sandboxed GPU process or kernel-level drivers, potentially causing memory corruption, though the GPU process is sandboxed on Windows and ChromeOS.

What the attacker needed

Victim opens a malicious video; hardware-accelerated video decoding enabled

The fix

The parser should apply an IN_RANGE_OR_RETURN check to bound long_term_frame_idx to the H.264 specification limits (e.g., 0 to 15).

How it was found

  1. Craft a malicious H.264 bitstream with an out-of-range long_term_frame_idx value.
  2. Deliver the video to a victim via an HTML video tag or the WebCodecs API.
  3. The browser routes the bitstream to the H264Parser, which parses the field without a bounds check.
  4. The unvalidated value is stored in H264Picture objects and later copied to accelerator delegate structures.
  5. On Windows, the value is narrowed to USHORT and placed in DXVA_PicParams_H264.FrameNumList; on ChromeOS, the full 31-bit value is placed in v4l2_h264_dpb_entry.pic_num.
  6. The tainted structures are submitted to the OS-level hardware video decoding drivers, potentially causing out-of-bounds memory access.

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.

A video file contains a number that tells the decoder which reference frame to use. The decoder does not check that this number is within a safe range, so a malicious video can provide a huge number. That number is then handed to the graphics driver, which may use it to access memory outside the intended area, potentially crashing or corrupting the system.

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.