From b1604e2ec78c55e2a025224b20e88a1dd0659e40 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 12 Nov 2021 16:37:10 +0900 Subject: [PATCH] common paint: fix invalid memory access in unit test casting the paint to shape is not allowed if the compositor target is not shape, here it concretely checking the the type before casting.... --- src/lib/tvgPaint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/tvgPaint.cpp b/src/lib/tvgPaint.cpp index a8f6e5ea..f20c920a 100644 --- a/src/lib/tvgPaint.cpp +++ b/src/lib/tvgPaint.cpp @@ -206,7 +206,7 @@ void* Paint::Impl::update(RenderMethod& renderer, const RenderTransform* pTransf we can avoid regular ClipPath / AlphaMasking sequence but use viewport for performance */ auto tryFastTrack = false; if (cmpMethod == CompositeMethod::ClipPath) tryFastTrack = true; - else if (cmpMethod == CompositeMethod::AlphaMask) { + else if (cmpMethod == CompositeMethod::AlphaMask && cmpTarget->identifier() == TVG_CLASS_ID_SHAPE) { auto shape = static_cast(cmpTarget); uint8_t a; shape->fillColor(nullptr, nullptr, nullptr, &a);