aboutsummaryrefslogtreecommitdiffstats
path: root/woff.c
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar Bram Stein <steinadobecom>2014-11-09 09:25:10 +0100
committerLibravatarLarge Libravatar Bram Stein <steinadobecom>2014-11-09 09:25:10 +0100
commit8e5d10f4dcc0676d6e8567857c64a550977599b1 (patch)
treefe043f35fa676672c9b2780b8f0c4e890c120c78 /woff.c
parente67716a2725037220a1d1226e12ff6212f1e5031 (diff)
downloadsfnt2woff-zopfli-8e5d10f4dcc0676d6e8567857c64a550977599b1.tar.gz
sfnt2woff-zopfli-8e5d10f4dcc0676d6e8567857c64a550977599b1.tar.bz2
sfnt2woff-zopfli-8e5d10f4dcc0676d6e8567857c64a550977599b1.tar.lz
sfnt2woff-zopfli-8e5d10f4dcc0676d6e8567857c64a550977599b1.zip

Fix bug with uninitialised variable.

Diffstat (limited to 'woff.c')
-rw-r--r--woff.c17
1 files changed, 3 insertions, 14 deletions
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));