From be7619f2f1269ce30259f237014a1b0273711de5 Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Tue, 14 Dec 2021 14:28:07 +0900 Subject: [PATCH] [Tizen] Prevent accessing invalid index This reverts commit 61c65ff82e80b793effc25abf729a2d3e4480356. --- dali/public-api/common/dali-vector.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dali/public-api/common/dali-vector.h b/dali/public-api/common/dali-vector.h index 80c6364..471e8b4 100644 --- a/dali/public-api/common/dali-vector.h +++ b/dali/public-api/common/dali-vector.h @@ -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(VectorBase::mData); address += index; return *address; -- 2.7.4