5
Vote

CompressImage corrupts the heap

description

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.

comments

r2d2rigo wrote Mar 2, 2013 at 12:38 AM

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