user32: fix potential crash when loading unsupported files

Vitaly Perov vitperov at
Wed Jul 27 09:13:26 CDT 2011

It fixes crash in LoadCursorFromFile when loading large jpg, png or gif files.

Generally, jpg, png or gif files have different internal structures. They can 
not be opened as CURSORICONFILEDIR structure.
If it happens, all the fields (idType, idReserved and idCount) are incorrect.
For a small files Wine luckily doesn't crash because of the contition:    
> if ( filesize < (sizeof(*dir) + sizeof(dir->idEntries[0])*(dir->idCount-1)) )
>        goto end;

Best regards,
Vitaly Perov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-user32-fix-potential-crash-when-loading-unsupported-.patch
Type: text/x-patch
Size: 731 bytes
Desc: not available
URL: <>

More information about the wine-patches mailing list