common paint: fix invalid memory access in unit test
authorHermet Park <chuneon.park@samsung.com>
Fri, 12 Nov 2021 07:37:10 +0000 (16:37 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Tue, 16 Nov 2021 08:37:47 +0000 (17:37 +0900)
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

index a8f6e5e..f20c920 100644 (file)
@@ -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<Shape*>(cmpTarget);
             uint8_t a;
             shape->fillColor(nullptr, nullptr, nullptr, &a);