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

Stefan Dösinger stefandoesinger at gmx.at
Thu May 10 13:39:49 CDT 2012


Am Donnerstag, 10. Mai 2012, 11:12:06 schrieb Józef Kucia:
> Surfaces pitches doesn't seem to be 4 or 8 byte aligned in DDS files.
> MSDN recommends to not use pitch_or_linear_size and gives formulas for
> computing pitches [1]. When it comes to formats mentioned by you,
> D3DFMT_P8 doesn't seem to be supported in DDS files. The formula from
> this patch also works for the dds_16bit file which stores pixels in
> D3DFMT_X1R5G5B5 format. Besides that, the patches series seems to work
> pretty well with at least two real applications.
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120510/2bc29be0/attachment.pgp>


More information about the wine-devel mailing list