CompressImage corrupts the heap


Squish.CompressImage has been hard coded to allocate a byte array large enough for a 4 by 4 pixel image. Attempting to compress an image larger than this can cause a FatalExecutionEngineError and crash the process.

Line 219 of Squish.cs:
byte[] compressedData = new byte[GetStorageRequirements(4, 4, flags)];

Replacing the 4s with width and height seems to fix the problem.


r2d2rigo wrote Mar 1, 2013 at 11:38 PM

Sorry, didn't visit CodePlex for a long time. I'll fix this ASAP and send a upload a new version to NuGet!

wrote Mar 29, 2013 at 3:29 PM

wrote Jul 31, 2014 at 2:00 AM