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.

This commit is contained in:
Con Kolivas 2013-09-14 11:45:23 +10:00
parent 6bb837761f
commit 47de07affb

View file

@ -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;