Re: [2/8] d3dx9: Check the size of a DDS file in D3DXGetImageInfoFromFileInMemory.
2012/5/9 Józef Kucia <joseph.kucia(a)gmail.com>:
+static HRESULT get_image_info_from_dds(const void *buffer, UINT length, D3DXIMAGE_INFO *info) { + UINT i; + UINT faces = 0; ... + /* calculate the expected length */ + width = info->Width; + height = info->Height; + for (i = 0; i < info->MipLevels; i++) + { + UINT pitch, size = 0; + calculate_dds_surface_size(info, width, height, &pitch, &size); + expected_length += size; + width = max(1, width / 2); + height = max(1, width / 2); + } + + if (length < expected_length) + return D3DXERR_INVALIDDATA;
It looks like you're not actually using the faces variable.
On Thu, May 10, 2012 at 4:27 PM, Matteo Bruni <matteo.mystral(a)gmail.com> wrote:
It looks like you're not actually using the faces variable.
Thanks. I should multiply expected_size by faces.
participants (2)
-
Józef Kucia -
Matteo Bruni