[Tizen] Prevent accessing invalid index 00/266700/1 submit/tizen/20211207.091609
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 17 Nov 2021 09:21:07 +0000 (18:21 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 17 Nov 2021 09:21:07 +0000 (18:21 +0900)
Change-Id: I31ce3b658bff9dadcf235d87257c0ca6bf82705b

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

index fd4565e..b461e1e 100644 (file)
@@ -548,7 +548,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;