CVE-2025-24209
Overview
Background
- CSS transform fast path
- An optimized parser for simple transform values (rotate/translate/scale) that indexes directly into the value string.
- Length gate
- A minimum-length check that makes a fixed set of indices safe; a longer branch needs its own, larger gate.
- argumentStart = 11
- The translate branch reads the value at index 11, requiring the string to be at least 12 characters.
Root Cause Analysis
This fixes an out-of-bounds read in the CSS transform fast-path parser. parseSimpleTransformValue first checks that the input has at least 9 characters (shortestValidTransformStringLength, for ‘rotate(0)’), which guarantees pos[0]..pos[8] are safe to read. It then detects the ’translate’ family by inspecting those bytes, and in the isTranslate branch reads further into the buffer — up to pos[11] (argumentStart = 11) and beyond — without any additional length check. Inputs like ’translatez’ (10 chars) or ’translate3d’ (11 chars) satisfy the isTranslate detection but are shorter than the indices the branch accesses, so reading pos[9..11] runs past the end of the buffer — an out-of-bounds read that can crash (or leak adjacent memory).
The fix adds, inside the isTranslate branch, a check end - pos < shortestValidTranslateStringLength (12, for ’translate(0)’) that returns nullptr before the higher-index reads.
The restored invariant is that each transform sub-parser verifies enough remaining length for every index it will access. The regression test sets transform to ’translatez’ and ’translate3d’.
Attack Path
- Set a short translate value Assign a CSS transform like ’translatez’ or ’translate3d’ (10-11 chars) that passes the 9-char length gate and the isTranslate detection.
- Access beyond the buffer The translate branch reads pos[9..11] without checking the string is at least 12 chars.
- Out-of-bounds read Reading past the end of the value buffer crashes or reads adjacent heap memory in WebContent.
Impact Assessment
Changed Functions
| Function | Change | Notes |
|---|---|---|
parseSimpleTransformValueSource/WebCore/css/parser/CSSParserFastPaths.cpp |
modified | Adds a shortestValidTranslateStringLength (12) check inside the isTranslate branch before reading up to pos[11], preventing an OOB read on short 'translate' inputs. |
Files Changed
LayoutTests/fast/css/transform-translate-parsing-crash-expected.txtLayoutTests/fast/css/transform-translate-parsing-crash.htmlSource/WebCore/css/parser/CSSParserFastPaths.cpp
Audit Directions
- Same function: per-branch lengthAudit parseSimpleTransformValue’s scale/translate3d/matrix branches for index accesses beyond the 9-char gate lacking their own length checks.
- Fixed-index string parsersGrep CSSParserFastPaths for pos[N] accesses guarded only by an earlier, smaller minimum-length check.