[Tizen] Prevent accessing invalid index accepted/tizen/unified/20211210.115319 submit/tizen/20211208.090024
authorEverLEEst(SangHyeon Lee) <sh10233.lee@samsung.com>
Wed, 8 Dec 2021 05:34:17 +0000 (14:34 +0900)
committerEverLEEst(SangHyeon Lee) <sh10233.lee@samsung.com>
Wed, 8 Dec 2021 05:34:17 +0000 (14:34 +0900)
This reverts commit d3bc1595bb51ee5cee25299519a93b4e45b8e21d.

dali/public-api/common/dali-vector.h

index 80c6364..471e8b4 100644 (file)
@@ -555,7 +555,11 @@ public: // API
   const ItemType& operator[](SizeType index) const
   {
     DALI_ASSERT_VECTOR(VectorBase::mData && "Vector is empty");
-    DALI_ASSERT_VECTOR(index < VectorBase::Count() && "Index out of bounds");
+    if(index >= VectorBase::Count())
+    {
+      // Prevent accessing invalid index
+      index = 0;
+    }
     ItemType* address = reinterpret_cast<ItemType*>(VectorBase::mData);
     address += index;
     return *address;