[Remote Snapshotting] Serialize fonts, gradients, filters and graphics state by value
Component: WebCore Display Lists | f59de9b
Source/WebCore/platform/graphics/displaylists/DisplayList.cpp
Remote snapshotting has the GPU process record page content as a display list and ship it to the print process, which replays it to produce PDF output. The GPU process renders web content that may include cross-origin iframes, so the serialized list can carry data derived from untrusted pages. Fonts, nested display lists and web font data are shared objects, so they are deduplicated into index tables and referenced by index inside items; the receiver rebuilds the tables (fonts first, then display lists bottom-up) and patches real objects back into the items.
DisplayListData now encodes fonts, web font data, gradients, graphics state, control parts, system images and filters by value. DrawGlyphs and DrawDisplayList can hold an index instead of a Font or nested DisplayList, and the decoder resolves these from the font, web-font and bottomUpDisplayLists tables, failing if any item remains unresolved. Items needing images, pattern brushes, the ARKit badge, and filters with a source image or FEImage still fail to encode.
GPU process Print process
encode: webFontData[] ─► fonts[] ─► bottomUpDisplayLists[]
│ IPC
▼
decode: parse webFontData ─► create Fonts ─► create nested DLs
─► create outer DL, replace indices with objects
─► any item still isResolved()==false ─► decode FAILS
Significance
This is a new cross-process decoder in the print process that parses web font bytes and index-linked object graphs received from the GPU process. The GPU-to-print channel goes from carrying plain-value items to a much larger surface.
Audit directions
- Index-to-object resolution. Check bounds on
fontIndexanddisplayListIndex, and whether a forward or self reference inbottomUpDisplayListscan slip past the ordering assumption (cycles, or aDrawDisplayListpointing at a list not yet built). - The
isResolved()gate. Confirm every index-holding item type is covered and nothing draws an item before resolution. TheDisplayListconstructor onlyASSERTs resolution, so release safety rests oncreateResolvingResourcesbeing the sole decode path and on theRELEASE_ASSERTs inapply(). - Web font parsing on the receiver. Attacker-controlled font bytes reach the platform font parser; check the Lockdown Mode parser choice, table sharing across fonts, and size limits.
- Glyph and advance vectors.
createResolvingResourcesalready rejects mismatched counts, so confirm that check runs for everyDrawGlyphsreaching aDisplayList(including already-resolved ones and nested lists) and that nothing mutates the vectors afterwards. The new publicGraphicsContextStateandSourceBrushconstructors can build states that never passed through the setters, so check change-flag consistency and gradient andspaceTransformvalues. - Reused coders in a new context. Filter and control-part decoding reuses existing coders, and the encode-failure carve-outs (pattern,
FEImage, ARKit badge) need to match what the decoder rejects. Structure-aware fuzzing ofDisplayListDatafits well, since the test covers only well-formed and a few invalid inputs.