pass the correct output buffer size to lzo1x_compress rather than the input buffer...
authorJonathan Marshall <jmarshall@never.you.mind>
Sun, 6 Jan 2013 02:24:04 +0000 (15:24 +1300)
committerS. Davilla <davilla@4pi.com>
Sun, 6 Jan 2013 13:36:07 +0000 (08:36 -0500)
tools/TexturePacker/XBMCTex.cpp

index 8db78eb..488e909 100644 (file)
@@ -196,7 +196,8 @@ CXBTFFrame appendContent(CXBTFWriter &writer, int width, int height, unsigned ch
   if ((flags & FLAGS_USE_LZO) == FLAGS_USE_LZO)
   {
     // grab a temporary buffer for unpacking into
-    unsigned char *packed  = new unsigned char[size + size / 16 + 64 + 3]; // see simple.c in lzo
+    packedSize = size + size / 16 + 64 + 3; // see simple.c in lzo
+    unsigned char *packed  = new unsigned char[packedSize];
     unsigned char *working = new unsigned char[LZO1X_999_MEM_COMPRESS];
     if (packed && working)
     {