From d21f8a5b5bb6ce9ba782602ed4ecc86081193cc1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 23 Aug 2019 11:39:53 +0200 Subject: [PATCH] backup/dynamic_index: explicitly zero-initialize the header The writer.write_all() call accessed data marked as undefined to valgrind. Note that we shouldn't write out uninitialized memory for security reasons anyway. (note that vec::undefined already did zero-initialize the data, but also marked it as undefined for valgrind when compiling with the valgrind feature) Signed-off-by: Wolfgang Bumiller --- src/backup/dynamic_index.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backup/dynamic_index.rs b/src/backup/dynamic_index.rs index 67f4dab2..ae3b284e 100644 --- a/src/backup/dynamic_index.rs +++ b/src/backup/dynamic_index.rs @@ -423,7 +423,7 @@ impl DynamicIndexWriter { let uuid = Uuid::new_v4(); - let mut buffer = vec::undefined(header_size); + let mut buffer = vec::zeroed(header_size); let header = crate::tools::map_struct_mut::(&mut buffer)?; header.magic = super::DYNAMIC_SIZED_CHUNK_INDEX_1_0;