From db2a3ac485aa5f81238d2acfa0cabe0929c8d36c Mon Sep 17 00:00:00 2001 From: Taehyub Kim Date: Tue, 9 Nov 2021 15:12:46 +0900 Subject: [PATCH] [Tizen] Add log to prevent invalid access to array This reverts commit ef0ba57e3e8824daa059d256083c67c8f692e9ec. --- dali/internal/graphics/gles-impl/gles-context.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dali/internal/graphics/gles-impl/gles-context.cpp b/dali/internal/graphics/gles-impl/gles-context.cpp index de5e058..f020e5b 100644 --- a/dali/internal/graphics/gles-impl/gles-context.cpp +++ b/dali/internal/graphics/gles-impl/gles-context.cpp @@ -29,6 +29,7 @@ #include "gles-graphics-render-target.h" #include +#include namespace Dali::Graphics::GLES { @@ -864,6 +865,12 @@ void Context::ActiveTexture(uint32_t textureBindingIndex) void Context::BindTexture(GLenum target, BoundTextureType textureTypeId, uint32_t textureId) { uint32_t typeId = static_cast(textureTypeId); + if(mImpl->mGlStateCache.mActiveTextureUnit >= MAX_TEXTURE_UNITS || typeId >= MAX_TEXTURE_TARGET) + { + DALI_LOG_ERROR("Invalid index (%d, %d)\n", mImpl->mGlStateCache.mActiveTextureUnit, typeId); + assert(0); + } + if(mImpl->mGlStateCache.mBoundTextureId[mImpl->mGlStateCache.mActiveTextureUnit][typeId] != textureId) { mImpl->mGlStateCache.mBoundTextureId[mImpl->mGlStateCache.mActiveTextureUnit][typeId] = textureId; -- 2.7.4