From 2e1fc25543ee0bf778ea34330ae98b1771daa3a8 Mon Sep 17 00:00:00 2001 From: Maeyanie Date: Mon, 4 Nov 2013 18:10:15 -0500 Subject: [PATCH] Fix 'Failed to malloc ckbuf in hash_search2' with very large files. lrzip was trying to malloc() enough memory to fit the entire length of file it was going to hash, instead of just the size of one chunk. This caused problems when combined with extremely large files. --- rzip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rzip.c b/rzip.c index ad7f0eb..942b4bb 100644 --- a/rzip.c +++ b/rzip.c @@ -745,7 +745,7 @@ static inline bool hash_search(rzip_control *control, struct rzip_state *st, cksum_chunks = control->checksum.len / control->maxram; cksum_remains = control->checksum.len % control->maxram; - control->checksum.buf = malloc(control->checksum.len); + control->checksum.buf = malloc(control->maxram); if (unlikely(!control->checksum.buf)) fatal_return(("Failed to malloc ckbuf in hash_search2\n"), false);