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

Józef Kucia joseph.kucia at gmail.com
Thu May 10 14:44:56 CDT 2012

On Thu, May 10, 2012 at 8:39 PM, Stefan Dösinger <stefandoesinger at gmx.at> wrote:
> Since I've burned my hands with DDSURFACEDESC2 pitch handling in the past(e.g.
> bug 21238), I highly recommend to test it. Knowing msdn, the above page makes
> me less confident, not more :-\
> The most likely situation where an error occurs is when a different API or
> tool(e.g. gdi32 or ddraw) uses a specific pitch and the application developers
> are not aware of it and just forward the data 1:1.
> Some test suggestions:
> *) See if the pitch_or_linearsize member is used at all
> *) Non-DWORD aligned pitches
> *) Pitches that are not pixel-size aligned
> *) pitch < width * byte_per_pixel
> *) Negative pitches / pitches > 2^31(Remember the LONG vs DWORD)
> *) A too small linear size for compressed surfaces(e.g. < block size)

Thanks for the suggestions.

Do you think this patch series can get in before tests for pitch
handling? The patch series is big enough and I don't want to make it
any bigger. The patch series also makes d3dx9 to pass almost all tests
for DDS file format support. Besides that, there are many things left
and improvements to be done until the DDS support in d3dx9 will be
completed. Amongst things to do the most problematic seems to be DXTn
compressor and decompressor. So I think these tests could be added in
the next series of patches. What do you think?

More information about the wine-devel mailing list