From d9110344b0c4e39513768639535824cbc12eb72e Mon Sep 17 00:00:00 2001 From: Nikolaos Patsiouras Date: Sat, 22 Jun 2019 22:45:19 +0300 Subject: [PATCH] * Fixed integer overflow when allocating space for very large textures. --- src/renderer_d3d11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 0daf936ab..cb91e3f27 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -4188,7 +4188,7 @@ namespace bgfx { namespace d3d11 if (convert) { uint32_t srcpitch = mip.m_width*bpp/8; - uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, mip.m_width*mip.m_height*bpp/8); + uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, srcpitch*mip.m_height); bimg::imageDecodeToBgra8(g_allocator, temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format); srd[kk].pSysMem = temp;