From f15008311af2be2923d99c2d115d76ae044a43eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 17 Jul 2015 11:12:41 -0700 Subject: [PATCH] Fixed issue #452. --- src/renderer_gl.cpp | 8 ++++++++ src/renderer_gl.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 8f91f649..b8d3c206 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -3410,6 +3410,10 @@ namespace bgfx { namespace gl m_used[used++] = ii; } } + BX_CHECK(used < BX_COUNTOF(m_used), "Out of bounds %d > array size %d." + , used + , BX_COUNTOF(m_used) + ); m_used[used] = Attrib::Count; used = 0; @@ -3422,6 +3426,10 @@ namespace bgfx { namespace gl m_instanceData[used++] = loc; } } + BX_CHECK(used < BX_COUNTOF(m_instanceData), "Out of bounds %d > array size %d." + , used + , BX_COUNTOF(m_instanceData) + ); m_instanceData[used] = 0xffff; } diff --git a/src/renderer_gl.h b/src/renderer_gl.h index 8c77fd25..7bd186cf 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -1061,7 +1061,7 @@ namespace bgfx { namespace gl uint8_t m_used[Attrib::Count+1]; // dense GLint m_attributes[Attrib::Count]; // sparse - GLint m_instanceData[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; + GLint m_instanceData[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT+1]; GLint m_sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; uint8_t m_numSamplers;