10 May
2012
10 May
'12
2:27 p.m.
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.