[Tizen] Prevent accessing invalid index accepted/tizen/unified/20211123.143831 submit/tizen/20211122.105712
authordongsug.song <dongsug.song@samsung.com>
Mon, 22 Nov 2021 07:39:10 +0000 (16:39 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Mon, 22 Nov 2021 07:39:28 +0000 (16:39 +0900)
This reverts commit 4365bb3d85446b7b08f1a0516a137f55c03f9d63.

Change-Id: Id9eb1a0559ca8a4c69442bbb8c25b1c2fb5b6598

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;