| 1 |
From 3150bddf3edd9ff7e9c3171a196cea2fb4d53a1f Mon Sep 17 00:00:00 2001 |
| 2 |
From: Michael Ludwig <[email protected]> |
| 3 |
Date: Tue, 21 Apr 2026 13:49:08 -0400 |
| 4 |
Subject: [PATCH] [sksl] Check allowSkSL for SkRuntimeImageFilter::CreateProc |
| 5 |
|
| 6 |
Since SkRuntimeImageFilter doesn't create its runtime shaders until |
| 7 |
actually evaluating the image filter, SkRuntimeShader's CreateProc |
| 8 |
was not being reached; it must be responsible for validating allowSkSL. |
| 9 |
|
| 10 |
Updates the unit test to confirm that all sources of runtime effects |
| 11 |
in drawables are detected when allowSkSl is false. |
| 12 |
|
| 13 |
Bug: https://issues.chromium.org/issues/502636904 |
| 14 |
Change-Id: I391ba2608010431429ac3e3c03e106f380304edb |
| 15 |
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1214636 |
| 16 |
Reviewed-by: Kaylee Lubick <[email protected]> |
| 17 |
Reviewed-by: Jorge Betancourt <[email protected]> |
| 18 |
Commit-Queue: Michael Ludwig <[email protected]> |
| 19 |
--- |
| 20 |
.../imagefilters/SkRuntimeImageFilter.cpp | 6 +- |
| 21 |
tests/SkGlyphTest.cpp | 98 +++++++++++++++---- |
| 22 |
2 files changed, 83 insertions(+), 21 deletions(-) |
| 23 |
|
| 24 |
diff --git a/src/effects/imagefilters/SkRuntimeImageFilter.cpp b/src/effects/imagefilters/SkRuntimeImageFilter.cpp |
| 25 |
index 96757809d0..5665f8357d 100644 |
| 26 |
--- a/src/effects/imagefilters/SkRuntimeImageFilter.cpp |
| 27 |
+++ b/src/effects/imagefilters/SkRuntimeImageFilter.cpp |
| 28 |
@@ -156,7 +156,11 @@ sk_sp<SkFlattenable> SkRuntimeImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 29 |
return nullptr; |
| 30 |
} |
| 31 |
|
| 32 |
- // Read the SkSL string and convert it into a runtime effect |
| 33 |
+ // Read the SkSL string and convert it into a runtime effect (if allowed) |
| 34 |
+ if (!buffer.validate(buffer.allowSkSL())) { |
| 35 |
+ return nullptr; |
| 36 |
+ } |
| 37 |
+ |
| 38 |
SkString sksl; |
| 39 |
buffer.readString(&sksl); |
| 40 |
auto effect = SkMakeCachedRuntimeEffect(SkRuntimeEffect::MakeForShader, std::move(sksl)); |
| 41 |
-- |
| 42 |
2.53.0 |
| 43 |
|