mirror of
https://github.com/microsoft/DirectXTex.git
synced 2025-07-09 11:40:14 +02: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;
|
return hr;
|
||||||
|
|
||||||
if (offset > size)
|
if (offset > size)
|
||||||
return E_FAIL;
|
return HRESULT_E_INVALID_DATA;
|
||||||
|
|
||||||
size_t paletteOffset = 0;
|
size_t paletteOffset = 0;
|
||||||
uint8_t palette[256 * 4] = {};
|
uint8_t palette[256 * 4] = {};
|
||||||
@ -1832,6 +1832,9 @@ HRESULT DirectX::LoadFromTGAFile(
|
|||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
if (offset > len)
|
||||||
|
return HRESULT_E_INVALID_DATA;
|
||||||
|
|
||||||
// Read the pixels
|
// Read the pixels
|
||||||
auto const remaining = len - offset;
|
auto const remaining = len - offset;
|
||||||
if (remaining == 0)
|
if (remaining == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user