From 47de07affb6a901b96c453af63ca5de52ff6c1fe Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 14 Sep 2013 11:45:23 +1000 Subject: [PATCH] Increase the compressed buffer size given to libzpaq in case of incompressible data since it does not check if it's trying to write beyond the end of the buffer. --- stream.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stream.c b/stream.c index d960691..b1b6f39 100644 --- a/stream.c +++ b/stream.c @@ -177,13 +177,14 @@ static int lzo_compresses(rzip_control *control, uchar *s_buf, i64 s_len); static int zpaq_compress_buf(rzip_control *control, struct compress_thread *cthread, long thread) { + i64 c_len, c_size; uchar *c_buf; - i64 c_len; if (!lzo_compresses(control, cthread->s_buf, cthread->s_len)) return 0; - c_buf = malloc(cthread->s_len + control->page_size); + c_size = round_up_page(control, cthread->s_len + 10000); + c_buf = malloc(c_size); if (!c_buf) { print_err("Unable to allocate c_buf in zpaq_compress_buf\n"); return -1;