]> wimlib.net Git - wimlib/commitdiff
lzms-compress.c: Add extra space for lz_analyze_block()
authorEric Biggers <ebiggers3@gmail.com>
Thu, 26 Dec 2013 23:11:04 +0000 (17:11 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 26 Dec 2013 23:11:04 +0000 (17:11 -0600)
src/lzms-compress.c

index 3169218288c79c676911ea3376be2a3688c4b3e9..b57b86e6bb6ef9c6753b37c87dd8f47a83c0e4e4 100644 (file)
@@ -709,6 +709,7 @@ lzms_init_compressor(struct lzms_compressor *ctx, const u8 *udata, u32 ulen,
 
        /* Copy the uncompressed data into the @ctx->window buffer.  */
        memcpy(ctx->window, udata, ulen);
+       memset(&ctx->window[ulen], 0, 8);
        ctx->cur_window_pos = 0;
        ctx->window_size = ulen;
 
@@ -961,7 +962,7 @@ lzms_create_compressor(size_t max_block_size,
        if (ctx == NULL)
                goto oom;
 
-       ctx->window = MALLOC(max_block_size);
+       ctx->window = MALLOC(max_block_size + 8);
        if (ctx->window == NULL)
                goto oom;