Fixed WICTextureLoader resize error that resulted in WINCODEC_ERR_INSUFFICIENTBUFFER

This commit is contained in:
Chuck Walbourn 2020-09-18 20:17:30 -07:00
parent 216e2b0388
commit 9dbde8de5d
2 changed files with 2 additions and 2 deletions

View File

@ -570,7 +570,7 @@ namespace
// Allocate temporary memory for image // Allocate temporary memory for image
uint64_t rowBytes = (uint64_t(twidth) * uint64_t(bpp) + 7u) / 8u; uint64_t rowBytes = (uint64_t(twidth) * uint64_t(bpp) + 7u) / 8u;
uint64_t numBytes = rowBytes * uint64_t(height); uint64_t numBytes = rowBytes * uint64_t(theight);
if (rowBytes > UINT32_MAX || numBytes > UINT32_MAX) if (rowBytes > UINT32_MAX || numBytes > UINT32_MAX)
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW); return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);

View File

@ -469,7 +469,7 @@ namespace
// Allocate memory for decoded image // Allocate memory for decoded image
uint64_t rowBytes = (uint64_t(twidth) * uint64_t(bpp) + 7u) / 8u; uint64_t rowBytes = (uint64_t(twidth) * uint64_t(bpp) + 7u) / 8u;
uint64_t numBytes = rowBytes * uint64_t(height); uint64_t numBytes = rowBytes * uint64_t(theight);
if (rowBytes > UINT32_MAX || numBytes > UINT32_MAX) if (rowBytes > UINT32_MAX || numBytes > UINT32_MAX)
return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW); return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);