From 3150bddf3edd9ff7e9c3171a196cea2fb4d53a1f Mon Sep 17 00:00:00 2001
From: Michael Ludwig <michaelludwig@google.com>
Date: Tue, 21 Apr 2026 13:49:08 -0400
Subject: [PATCH] [sksl] Check allowSkSL for SkRuntimeImageFilter::CreateProc

Since SkRuntimeImageFilter doesn't create its runtime shaders until
actually evaluating the image filter, SkRuntimeShader's CreateProc
was not being reached; it must be responsible for validating allowSkSL.

Updates the unit test to confirm that all sources of runtime effects
in drawables are detected when allowSkSl is false.

Bug: https://issues.chromium.org/issues/502636904
Change-Id: I391ba2608010431429ac3e3c03e106f380304edb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1214636
Reviewed-by: Kaylee Lubick <kjlubick@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
---
 .../imagefilters/SkRuntimeImageFilter.cpp     |  6 +-
 tests/SkGlyphTest.cpp                         | 98 +++++++++++++++----
 2 files changed, 83 insertions(+), 21 deletions(-)

diff --git a/src/effects/imagefilters/SkRuntimeImageFilter.cpp b/src/effects/imagefilters/SkRuntimeImageFilter.cpp
index 96757809d0..5665f8357d 100644
--- a/src/effects/imagefilters/SkRuntimeImageFilter.cpp
+++ b/src/effects/imagefilters/SkRuntimeImageFilter.cpp
@@ -156,7 +156,11 @@ sk_sp<SkFlattenable> SkRuntimeImageFilter::CreateProc(SkReadBuffer& buffer) {
         return nullptr;
     }
 
-    // Read the SkSL string and convert it into a runtime effect
+    // Read the SkSL string and convert it into a runtime effect (if allowed)
+    if (!buffer.validate(buffer.allowSkSL())) {
+        return nullptr;
+    }
+
     SkString sksl;
     buffer.readString(&sksl);
     auto effect = SkMakeCachedRuntimeEffect(SkRuntimeEffect::MakeForShader, std::move(sksl));
-- 
2.53.0

