mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Fixed out of bound access when running out of matrix cache.
This commit is contained in:
@@ -907,7 +907,10 @@ namespace bgfx
|
||||
uint32_t num = *_num;
|
||||
BX_WARN(m_num+num < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache overflow. %d (max: %d)", m_num+num, BGFX_CONFIG_MAX_MATRIX_CACHE);
|
||||
num = bx::uint32_min(num, BGFX_CONFIG_MAX_MATRIX_CACHE-m_num);
|
||||
uint32_t first = m_num;
|
||||
uint32_t first = m_num < BGFX_CONFIG_MAX_MATRIX_CACHE
|
||||
? m_num
|
||||
: BGFX_CONFIG_MAX_MATRIX_CACHE - 1
|
||||
;
|
||||
m_num += num;
|
||||
*_num = (uint16_t)num;
|
||||
return first;
|
||||
|
||||
Reference in New Issue
Block a user