From 53e66ba1e94a44d953c7f2a4e3d5fc5c5d3d9d46 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Wed, 7 Sep 2016 14:59:04 -0700 Subject: [PATCH] DDS parsing error handling --- DirectXTex/DirectXTexDDS.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DirectXTex/DirectXTexDDS.cpp b/DirectXTex/DirectXTexDDS.cpp index 79a410c..fb2cc9a 100644 --- a/DirectXTex/DirectXTexDDS.cpp +++ b/DirectXTex/DirectXTexDDS.cpp @@ -1069,7 +1069,10 @@ static HRESULT _CopyImage( _In_reads_bytes_(size) const void* pPixels, _In_ size return E_FAIL; } - assert( pixelSize <= size ); + if (pixelSize > size) + { + return E_FAIL; + } std::unique_ptr timages( new (std::nothrow) Image[nimages] ); if ( !timages )