[Tizen] Add log to prevent invalid access to array 75/267075/2
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 17 Nov 2021 09:21:52 +0000 (18:21 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Mon, 6 Dec 2021 06:48:22 +0000 (06:48 +0000)
Change-Id: I7fdcf70f8fd82b9b325f5a1f79b223d507521d04

dali/internal/graphics/gles-impl/gles-context.cpp

index de5e058..9c21096 100644 (file)
@@ -864,6 +864,12 @@ void Context::ActiveTexture(uint32_t textureBindingIndex)
 void Context::BindTexture(GLenum target, BoundTextureType textureTypeId, uint32_t textureId)
 {
   uint32_t typeId = static_cast<uint32_t>(textureTypeId);
+  if(mImpl->mGlStateCache.mActiveTextureUnit >= MAX_TEXTURE_UNITS || typeId >= MAX_TEXTURE_TARGET)
+  {
+    DALI_LOG_ERROR("Invalid index (%d, %d)\n", mImpl->mGlStateCache.mActiveTextureUnit, typeId);
+    std::abort();
+  }
+
   if(mImpl->mGlStateCache.mBoundTextureId[mImpl->mGlStateCache.mActiveTextureUnit][typeId] != textureId)
   {
     mImpl->mGlStateCache.mBoundTextureId[mImpl->mGlStateCache.mActiveTextureUnit][typeId] = textureId;