mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-09 14:30:05 +00:00
Missing offset boundary check in TGA reader (#429)
This commit is contained in:
parent
dd5517fd06
commit
eb594ad36c
@ -1658,7 +1658,7 @@ HRESULT DirectX::LoadFromTGAMemory(
|
||||
return hr;
|
||||
|
||||
if (offset > size)
|
||||
return E_FAIL;
|
||||
return HRESULT_E_INVALID_DATA;
|
||||
|
||||
size_t paletteOffset = 0;
|
||||
uint8_t palette[256 * 4] = {};
|
||||
@ -1832,6 +1832,9 @@ HRESULT DirectX::LoadFromTGAFile(
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (offset > len)
|
||||
return HRESULT_E_INVALID_DATA;
|
||||
|
||||
// Read the pixels
|
||||
auto const remaining = len - offset;
|
||||
if (remaining == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user