From eac15152bf4bea57c0720d8e9c16702393a2b24b Mon Sep 17 00:00:00 2001 From: Kaylee Lubick Date: Mon, 8 Jun 2026 18:12:57 +0000 Subject: [PATCH] Avoid improper mask formats for SDFT runs SDFTSubRun has a hard assumption of the kA8 mask format and if the vertex filler differs, there will be a memory mismatch. This catches it when deserializing the Slug and changes the debug-only assert to be runtime to make sure we don't miss other places. Bug: https://issues.chromium.org/issues/520571816 Fixed: 520571816 Change-Id: I9ae3e509397e23d38d621cb7eb8bb5b955a43d7d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1257397 Commit-Queue: Kaylee Lubick Reviewed-by: Michael Ludwig Reviewed-by: Thomas Smith --- src/text/gpu/SubRunContainer.cpp | 4 +- tests/SlugTest.cpp | 63 ++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) --- a/src/text/gpu/SubRunContainer.cpp +++ b/src/text/gpu/SubRunContainer.cpp @@ -909,7 +909,7 @@ , fUseLCDText{useLCDText} , fAntiAliased{antiAliased} , fMatrixRange{matrixRange} { - SkASSERT(fVertexFiller.grMaskType() == MaskFormat::kA8); + SkASSERT_RELEASE(fVertexFiller.grMaskType() == MaskFormat::kA8); } static SubRunOwner Make(SkZip accepted, @@ -959,6 +959,8 @@ skglyph::kSDFT, kGlyphInsetting); if (!buffer.validate(vertexFiller.has_value())) { return nullptr; } + if (!buffer.validate(vertexFiller->maskFormat() == MaskFormat::kA8)) { return nullptr; } + return alloc->makeUnique(useLCD, isAntiAliased, matrixRange,