[Tizen] Fix svace : assert some cases 26/307026/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Sun, 3 Mar 2024 23:57:12 +0000 (08:57 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 5 Mar 2024 03:48:50 +0000 (12:48 +0900)
This is a combination of 2 commits.

Fix svace : assert when we fail to register animatable properties

Fix svace : Assert when malloc matrix failed

It is possible to fail malloc memory. Let we notify this case.

Change-Id: Ice13e4f5a845f28d947fb9f0edff002e1b4b1c89
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/common/matrix-utils.cpp
dali/internal/event/common/object-impl.cpp

index 6ad3d7d..5ee80d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -438,6 +438,7 @@ void MultiplyAssign(Dali::Matrix& result, const Dali::Matrix& rhs)
   {
     // If rhs is same matrix with result, we need to copy temperal vaules.
     temp = static_cast<float*>(malloc(NUM_BYTES_IN_MATRIX));
+    DALI_ASSERT_ALWAYS(temp && "malloc is failed.");
     memcpy(temp, rhsPtr, NUM_BYTES_IN_MATRIX);
     rhsPtr = temp;
   }
@@ -571,6 +572,7 @@ void MultiplyAssign(Dali::Matrix3& result, const Dali::Matrix3& rhs)
   {
     // If rhs is same matrix with result, we need to copy temperal vaules.
     temp = static_cast<float*>(malloc(NUM_BYTES_IN_MATRIX3));
+    DALI_ASSERT_ALWAYS(temp && "malloc is failed.");
     memcpy(temp, rhsPtr, NUM_BYTES_IN_MATRIX3);
     rhsPtr = temp;
   }
index 8859047..5200ac0 100644 (file)
@@ -1222,12 +1222,15 @@ AnimatablePropertyMetadata* Object::GetSceneAnimatableProperty(Property::Index i
         {
           // If the base property is not registered yet, register the base property first.
           RegisterAnimatableProperty(*typeInfo, basePropertyIndex, value);
+          DALI_ASSERT_ALWAYS(mAnimatableProperties.Size() > 0u && "Something wrong when we register animatable base property!");
+
           animatableProperty = static_cast<AnimatablePropertyMetadata*>(mAnimatableProperties[mAnimatableProperties.Size() - 1]);
         }
 
         // Create the metadata for the property component.
         mAnimatableProperties.PushBack(new AnimatablePropertyMetadata(index, typeInfo->GetComponentIndex(index), animatableProperty->value, animatableProperty->GetSceneGraphProperty()));
       }
+      DALI_ASSERT_ALWAYS(mAnimatableProperties.Size() > 0u && "Something wrong when we register new animatable property!");
 
       // The metadata has just been added and therefore should be in the end of the vector.
       animatableProperty = static_cast<AnimatablePropertyMetadata*>(mAnimatableProperties[mAnimatableProperties.Size() - 1]);