Skip to content

Commit e9d10f3

Browse files
subraatakumarcodingsubratawcandillon
authored
fix(šŸ›): avoid dangling pointer when reading runtime shader child name (#3614)
Co-authored-by: Subrata <[email protected]> Co-authored-by: William Candillon <[email protected]>
1 parent a3dcac1 commit e9d10f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ā€Žpackages/skia/cpp/api/JsiSkImageFilterFactory.hā€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,11 @@ class JsiSkImageFilterFactory : public JsiSkHostObject {
245245
JSI_HOST_FUNCTION(MakeRuntimeShader) {
246246
auto rtb = JsiSkRuntimeShaderBuilder::fromValue(runtime, arguments[0]);
247247

248-
const char *childName = "";
248+
std::string childNameStr = "";
249+
const char *childName = childNameStr.c_str();
249250
if (hasOptionalArgument(arguments, count, 1)) {
250-
childName = arguments[1].asString(runtime).utf8(runtime).c_str();
251+
childNameStr = arguments[1].asString(runtime).utf8(runtime);
252+
childName = childNameStr.c_str();
251253
}
252254

253255
sk_sp<SkImageFilter> input = nullptr;

0 commit comments

Comments
Ā (0)