Insufficient validation of untrusted input in Skia (CVE-2026-8579)
Skia's ReadPageSizes function deserialises page dimensions without upper-bound validation, allowing a compromised renderer to supply huge page sizes. This causes massive memory allocations and integer overflows in the PrintCompositor process, leading to a denial of service.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 48 days
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: SkMultiPictureDocument::ReadPageSizes deserializes page dimensions without checking for excessively large values. A compromised renderer can send a malicious MSKP file with huge page sizes, causing massive memory allocations and integer overflows in Skia, leading to a Denial of Service in the PrintCompositor process.
Affected files:
third_party/skia/src/utils/SkMultiPictureDocument.cppthird_party/skia/src/pdf/SkPDFDocument.cppthird_party/skia/src/core/SkDocument.cppcomponents/services/print_compositor/print_compositor_impl.cc
Estimated timestamp from git blame: 2025-03-24
Summary
The SkMultiPictureDocument::ReadPageSizes function in Skia lacks upper-bound validation for page dimensions read from its input stream. This enables a compromised renderer to specify extremely large page sizes that are subsequently used by the PrintCompositor process. This issue leads to a Denial of Service via memory exhaustion and triggers integer overflows in downstream Skia components like mask filters.
Technical Details
When processing a SkMultiPictureDocument (MSKP) in the PrintCompositor utility process, the following data flow occurs:
- Deserialization: In
third_party/skia/src/utils/SkMultiPictureDocument.cpp, theReadPageSizesfunction readsSkSizevalues (floats) directly from the stream without any validation against upper bounds, infinity, or NaN. - Page Initiation: These unvalidated sizes are passed through
PrintCompositorImpltoSkDocument::beginPageinthird_party/skia/src/core/SkDocument.cpp. - PDF Generation: In
third_party/skia/src/pdf/SkPDFDocument.cpp, theonBeginPagemethod multiplies the dimensions byfRasterScale. The resulting value is rounded to an integer viatoRound(), which saturates toINT32_MAX. This results in anSkPDFDevicebeing initialized with massive bounds. - Integer Overflows in Filters: If the attacker also includes a drawing command with an
SkTableMaskFilter, the large device bounds propagate toSkPDFDevice::internalDrawPathWithFilter. The bounds are used to compute the size of masks. For example, inSkTableMaskFilterImpl::filterMask, the calculationdst->rowBytes() = SkAlign4(dst->fBounds.width())can overflowint32_t, anddst->computeImageSize()returns 0 due tosafeMul32returning 0 for sizes> INT32_MAX. This leads to a 0-byte allocation followed by a massive linear out-of-bounds write of >2GB, causing an immediate segmentation fault.
Impact
An attacker with control over a renderer process can send a malicious MSKP via the DidPrintContentParams.metafile_data_region IPC. This reachability allows the attacker to reliably crash the sandboxed PrintCompositor utility process by triggering massive out-of-bounds writes (which are guaranteed to hit unmapped guard pages) or OOMs, resulting in a Denial of Service.
Reproduction Steps (Suggested)
- In a compromised renderer, generate an MSKP file.
- Add a page with
SkSizeset to dimensions that scale to approximatelyINT32_MAX(e.g., width =1073741821, height =2). - Add a path to the page that fills the dimensions, and apply an
SkTableMaskFilterto the paint. - Send the MSKP via IPC to the
PrintCompositor. - Observe the
PrintCompositorprocess crash due to an OOM or a segmentation fault when Skia attempts to allocate or write to the massive mask buffer.
Suggested Fix
In third_party/skia/src/utils/SkMultiPictureDocument.cpp, ReadPageSizes should validate the deserialized SkSize values. If the width or height is negative, non-finite, or exceeds a reasonable maximum document size, the function should return false to reject the malformed document.
Evaluated with Chrome root at commit: 0eb4855bda702feaaa8b899336664f97e3df88b8
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. Please feel free to reach out to me if you have concerns or feedback.
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 ReadPageSizes function lacks validation for upper bounds, infinity, or NaN on deserialised page dimensions.
Impact
An attacker with control over a renderer process can reliably crash the sandboxed PrintCompositor utility process by triggering massive out-of-bounds writes or OOMs, resulting in a denial of service.
What the attacker needed
Compromised renderer process
The fix
ReadPageSizes should validate deserialised SkSize values and reject documents with negative, non-finite, or excessively large dimensions.
How it was found
- In a compromised renderer, generate an MSKP file.
- Add a page with SkSize set to dimensions that scale to approximately INT32_MAX.
- Add a path to the page that fills the dimensions, and apply an SkTableMaskFilter to the paint.
- Send the MSKP via IPC to the PrintCompositor.
- Observe the PrintCompositor process crash due to an OOM or a segmentation fault.
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 renderer process (the part of the browser that draws web pages) can send a specially crafted file to a printing component. That file contains page sizes that are far too large, and the printing component does not check them. This makes the printing component try to allocate enormous amounts of memory or write outside its buffers, which crashes it.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.