common shape: fix memory access violation
authorHermet Park <chuneon.park@samsung.com>
Thu, 18 Nov 2021 02:31:15 +0000 (11:31 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Fri, 19 Nov 2021 05:27:38 +0000 (14:27 +0900)
asan report:

../src/lib/tvgShapeImpl.h:94:15: runtime error: null pointer passed as argument 2, which is declared to never be null
../src/lib/tvgShapeImpl.h:101:15: runtime error: null pointer passed as argument 2, which is declared to never be null

src/lib/tvgShapeImpl.h

index c887f04..32aa00a 100644 (file)
@@ -84,6 +84,8 @@ struct ShapePath
 
     void duplicate(const ShapePath* src)
     {
+        if (src->cmdCnt == 0 || src->ptsCnt == 0) return;
+
         cmdCnt = src->cmdCnt;
         reservedCmdCnt = src->reservedCmdCnt;
         ptsCnt = src->ptsCnt;