Heap buffer overflow in Codecs (CVE-2026-8529)
A mismatch between parser limits and internal array sizes in Chrome's H.265 decoder allows out-of-bounds writes. An attacker can bypass base-layer validation using auxiliary alpha layers and dependent slice segments, leading to heap and stack buffer overflows and potentially GPU process RCE.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
Flapjack (go/flapjack), an LLM-powered static analysis tool, has identified the following potential security issue.
Overview: A discrepancy between parser limits and internal array sizes in H265Decoder allows out-of-bounds writes. An attacker can bypass base-layer validation checks using auxiliary alpha layers and dependent slice segments. This leads to heap and stack buffer overflows, potentially resulting in GPU process RCE.
Affected files:
media/gpu/h265_decoder.ccmedia/parsers/h265_parser.ccmedia/gpu/h265_decoder.hmedia/parsers/h265_parser.h
Estimated timestamp from git blame: 2025-08-07
Summary
A critical vulnerability exists in Chrome's H.265 video decoder implementation (media/gpu/h265_decoder.cc). A mismatch between the maximum allowed long-term reference pictures in the parser (kMaxLongTermRefPicSets = 32) and the fixed-size tracking arrays in the decoder (kMaxDpbSize = 16) can be exploited to cause severe heap and stack buffer overflows. An attacker can bypass the parser's validation checks by utilizing auxiliary alpha layers and dependent slice segments, leading to arbitrary code execution in the sandboxed GPU process.
Root Cause Analysis
In media/parsers/h265_parser.cc, the ParseSliceHeader function reads the number of long-term reference pictures (num_long_term_pics). A bounds check ensures this value, combined with num_long_term_sps, does not exceed sps_max_dec_pic_buffering_minus1 (which is implicitly capped at 15 for base layers). However, this check is explicitly bypassed for non-base layers:
// media/parsers/h265_parser.cc:1241
if (nalu.nuh_layer_id == 0) {
TRUE_OR_RETURN(
shdr->num_long_term_pics <=
(sps->sps_max_dec_pic_buffering_minus1[clamped_temporal_id] - ...));
}
For an auxiliary alpha layer NALU (nuh_layer_id != 0), this check is skipped, allowing num_long_term_pics to reach the absolute maximum defined by kMaxLongTermRefPicSets (32).
When a subsequent base layer NALU (nuh_layer_id == 0) with dependent_slice_segment_flag == 1 is parsed, the parser copies the state from the previous slice header (prior_shdr) into the new slice header using memcpy:
// media/parsers/h265_parser.cc:1159
size_t skip_amount = offsetof(H265SliceHeader, slice_type);
UNSAFE_TODO(memcpy(reinterpret_cast<uint8_t*>(shdr) + skip_amount,
reinterpret_cast<uint8_t*>(prior_shdr) + skip_amount,
sizeof(H265SliceHeader) - skip_amount));
Because num_long_term_pics and its associated arrays are located after slice_type in the H265SliceHeader struct, they are blindly copied into the base layer header. The validation logic for dependent slices fails to re-evaluate the strict base-layer bounds check, allowing the base layer to inherit the unvalidated 32 LTRP count.
Exploitation Steps
An attacker would trigger this vulnerability using the following sequence:
- Provide a malicious bitstream with a VPS indicating an auxiliary alpha layer, and an SPS with
long_term_ref_pics_present_flag = 1. - Send an auxiliary alpha layer NALU (
nuh_layer_id != 0) containing up to 32 long-term reference pictures. The parser accepts this and stores it aslast_slice_hdr_. - Send a base layer NALU (
nuh_layer_id == 0) withdependent_slice_segment_flag == 1. The parser copies the 32 LTRP count into the base layer slice header. H265Decoder::StartNewFrameprocesses the base layer slice and callsCalcRefPicPocs.CalcRefPicPocsiterates up to 32 times, writing attacker-controlled data intopoc_lt_curr_orpoc_lt_foll_and their correspondingdelta_poc_msb_present_flagarrays. These arestd::arraymembers of sizekMaxDpbSize(16). This results in a 64-byte heap buffer overflow.- This overflow clobbers adjacent class members, most notably
ref_pic_list0_(astd::vector). By overwriting the internal pointers of this vector with controlled values, the attacker can manipulate arbitrary memory when vector operations (like.clear()or.push_back()) are later invoked. - Next,
StartNewFramecallsBuildRefPicLists, which allocates astd::array<scoped_refptr<H265Picture>, kMaxDpbSize> ref_pic_set_lt_follon the stack. - A loop iterates up to 32 times (based on
num_poc_lt_foll_), writingscoped_refptrobjects into this 16-element stack array, resulting in a severe stack buffer overflow.
Security Impact
The combination of heap corruption (vector hijacking leading to arbitrary scoped_refptr AddRef/Release operations) and stack corruption (overwriting return addresses with pointers to heap objects) provides highly reliable primitives for Remote Code Execution (RCE) within the GPU process. This issue is reachable on Apple platforms where IsAlphaLayerSupported() returns true.
Evaluated with Chrome root at commit: 818af3d59a508e1d651545a5bed0175ff7406aa3
Results from Flapjack so far have been promising, but it can be wrong in its deductions. At this time, it does not produce proof of concepts or fuzzer tests. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve Flapjack’s accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
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
The parser skips a bounds check for non-base layers, allowing a higher count of long-term reference pictures that is then copied into a base-layer slice header without re-validation, causing out-of-bounds writes in the decoder's fixed-size arrays.
Impact
The combination of heap and stack corruption provides highly reliable primitives for Remote Code Execution (RCE) within the GPU process, but the issue is reachable only on Apple platforms where IsAlphaLayerSupported() returns true.
What the attacker needed
Apple platform with alpha layer support; Malicious H.265 bitstream
How it was found
- Provide a malicious bitstream with a VPS indicating an auxiliary alpha layer, and an SPS with long_term_ref_pics_present_flag = 1.
- Send an auxiliary alpha layer NALU (nuh_layer_id != 0) containing up to 32 long-term reference pictures.
- Send a base layer NALU (nuh_layer_id == 0) with dependent_slice_segment_flag == 1.
- H265Decoder::StartNewFrame processes the base layer slice and calls CalcRefPicPocs.
- CalcRefPicPocs iterates up to 32 times, writing attacker-controlled data into poc_lt_curr_ or poc_lt_foll_ and their corresponding delta_poc_msb_present_flag arrays, causing a 64-byte heap buffer overflow.
- StartNewFrame calls BuildRefPicLists, which allocates a stack array of size kMaxDpbSize (16) and a loop iterates up to 32 times, writing scoped_refptr objects into this 16-element stack array, resulting in a severe stack buffer overflow.
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.
The H.265 video decoder in Chrome has a limit on how many reference pictures it can track, but the parser allows more than the decoder's arrays can hold. An attacker can craft a video file that tricks the decoder into writing past the end of its arrays, corrupting memory. This could let them run their own code inside the GPU process, which is a sandboxed part of the browser.
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.