Need to zero-fill allocated memory returned by page_aligned_alloc
in case of initializing a new buffer for an archive.
Otherwise there's a chance of checksum error in case of checking compressed 
files.
---
 src/buffer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/buffer.c b/src/buffer.c
index 723ea71..cba54b2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -626,9 +626,11 @@ xclose (int fd)
 static void
 init_buffer (void)
 {
-  if (! record_buffer_aligned[record_index])
+  if (! record_buffer_aligned[record_index]){
     record_buffer_aligned[record_index] =
       page_aligned_alloc (&record_buffer[record_index], record_size);
+    memset(record_buffer_aligned[record_index], 0, record_size);
+  }
 
   record_start = record_buffer_aligned[record_index];
   current_block = record_start;
-- 
1.8.5.2


Reply via email to