From 8e5d10f4dcc0676d6e8567857c64a550977599b1 Mon Sep 17 00:00:00 2001 From: Bram Stein Date: Sun, 9 Nov 2014 09:25:10 +0100 Subject: Fix bug with uninitialised variable. --- woff.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'woff.c') diff --git a/woff.c b/woff.c index 0ea8e17..18e2a85 100644 --- a/woff.c +++ b/woff.c @@ -256,7 +256,9 @@ woffEncode(const uint8_t * sfntData, uint32_t sfntLen, ZopfliInitOptions(&options); for (order = 0; order < numTables; ++order) { - uLong sourceLen, destLen; + uLong sourceLen, destLen = 0; + + uint8_t* dest = 0; uint32_t sourceOffset; uint16_t oldIndex = tableOrder[order].oldIndex; @@ -281,22 +283,9 @@ woffEncode(const uint8_t * sfntData, uint32_t sfntLen, if (sourceLen > sfntLen || sourceOffset > sfntLen - sourceLen) { FAIL(eWOFF_invalid); } - //destLen = LONGALIGN(compressBound(sourceLen)); - //woffData = (uint8_t *) realloc(woffData, tableOffset + destLen); - //if (!woffData) { - // FAIL(eWOFF_out_of_memory); - //} - - uint8_t* dest = 0; ZopfliZlibCompress(&options, (const uint8_t *) (sfntData + sourceOffset), sourceLen, &dest, &destLen); - /* do the compression directly into the WOFF data block */ - //if (compress2((Bytef *) (woffData + tableOffset), &destLen, - // (const Bytef *) (sfntData + sourceOffset), - // sourceLen, 9) != Z_OK) { - // FAIL(eWOFF_compression_failure); - //} if (destLen < sourceLen) { /* compressed table was smaller */ woffData = (uint8_t *) realloc(woffData, tableOffset + LONGALIGN(destLen)); -- cgit v1.2.3