Преглед изворни кода

Merge pull request #1798 from NPatch/fix_tex_create_uint_overflow

* Fixed integer overflow when allocating space for very large textures.
Бранимир Караџић пре 6 година
родитељ
комит
c73fb9d445
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      src/renderer_d3d11.cpp

+ 1 - 1
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;