If a user attemps to load a file that has a width and/
or height that is not a multiple of four (say 333x333),
freeimage will crash. While not elegant, this small
patch will prevent freeimage from crashing.
There are two places that need to be patched, LoadRGB(
...) and LoadDXT(...). Both functions are located in
PluginDDS.cpp.
In both LoadDXT(...) and LoadRGB(...) you will find
these lines at the beginning of the function:
int width = (int)desc.dwWidth;
int height = (int)desc.dwHeight;
The fix is to replace these lines with:
int width = (int)desc.dwWidth & ~3;
int height = (int)desc.dwHeight & ~3;
This patch should only affect images that would cause
the software to crash. It should not affect images that
are a multiple of four.
Anonymous
a DDS file that is 333x333
Logged In: YES
user_id=613758
Many thanks for this patch :)
I just added it to the CVS : the fix will be available in
the next release.
Hervé Drolon
FreeImage Project Manager
Logged In: YES
user_id=1312539
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).