| 1 |
From eac15152bf4bea57c0720d8e9c16702393a2b24b Mon Sep 17 00:00:00 2001 |
| 2 |
From: Kaylee Lubick <[email protected]> |
| 3 |
Date: Mon, 8 Jun 2026 18:12:57 +0000 |
| 4 |
Subject: [PATCH] Avoid improper mask formats for SDFT runs |
| 5 |
|
| 6 |
SDFTSubRun has a hard assumption of the kA8 mask format and |
| 7 |
if the vertex filler differs, there will be a memory mismatch. |
| 8 |
|
| 9 |
This catches it when deserializing the Slug and changes the |
| 10 |
debug-only assert to be runtime to make sure we don't miss other |
| 11 |
places. |
| 12 |
|
| 13 |
Bug: https://issues.chromium.org/issues/520571816 |
| 14 |
Fixed: 520571816 |
| 15 |
Change-Id: I9ae3e509397e23d38d621cb7eb8bb5b955a43d7d |
| 16 |
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1257397 |
| 17 |
Commit-Queue: Kaylee Lubick <[email protected]> |
| 18 |
Reviewed-by: Michael Ludwig <[email protected]> |
| 19 |
Reviewed-by: Thomas Smith <[email protected]> |
| 20 |
--- |
| 21 |
src/text/gpu/SubRunContainer.cpp | 4 +- |
| 22 |
tests/SlugTest.cpp | 63 ++++++++++++++++++++++++++++++++ |
| 23 |
2 files changed, 66 insertions(+), 1 deletion(-) |
| 24 |
|
| 25 |
--- a/src/text/gpu/SubRunContainer.cpp |
| 26 |
+++ b/src/text/gpu/SubRunContainer.cpp |
| 27 |
@@ -909,7 +909,7 @@ |
| 28 |
, fUseLCDText{useLCDText} |
| 29 |
, fAntiAliased{antiAliased} |
| 30 |
, fMatrixRange{matrixRange} { |
| 31 |
- SkASSERT(fVertexFiller.grMaskType() == MaskFormat::kA8); |
| 32 |
+ SkASSERT_RELEASE(fVertexFiller.grMaskType() == MaskFormat::kA8); |
| 33 |
} |
| 34 |
|
| 35 |
static SubRunOwner Make(SkZip<const SkPackedGlyphID, const SkPoint> accepted, |
| 36 |
@@ -959,6 +959,8 @@ |
| 37 |
skglyph::kSDFT, kGlyphInsetting); |
| 38 |
if (!buffer.validate(vertexFiller.has_value())) { return nullptr; } |
| 39 |
|
| 40 |
+ if (!buffer.validate(vertexFiller->maskFormat() == MaskFormat::kA8)) { return nullptr; } |
| 41 |
+ |
| 42 |
return alloc->makeUnique<SDFTSubRun>(useLCD, |
| 43 |
isAntiAliased, |
| 44 |
matrixRange, |