[Tizen] Prevent accessing invalid index accepted/tizen/unified/20211129.212425 submit/tizen/20211129.091245
authorhuiyu.eun <huiyu.eun@samsung.com>
Mon, 29 Nov 2021 07:52:48 +0000 (16:52 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Mon, 29 Nov 2021 07:52:51 +0000 (16:52 +0900)
This reverts commit 2a8bf0bda3509659512d86dc68870b8306b98260.

Change-Id: I9589aee858df56950a2182584171ec5ed96af82a

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;