[2/8] d3dx9: Check the size of a DDS file in D3DXGetImageInfoFromFileInMemory.

Matteo Bruni matteo.mystral at gmail.com
Thu May 10 09:27:38 CDT 2012


2012/5/9 Józef Kucia <joseph.kucia at 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.



More information about the wine-devel mailing list