[epiphany/mcatanzaro/gvdb: 1/2] gvdb: fix uninitialized memory writes



commit 8bf2b6744ee6626e95ad80fdacda7f8ae044b828
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Mar 18 10:42:36 2020 -0500

    gvdb: fix uninitialized memory writes

 lib/contrib/gvdb/README.epiphany | 4 ++--
 lib/contrib/gvdb/gvdb-builder.c  | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/lib/contrib/gvdb/README.epiphany b/lib/contrib/gvdb/README.epiphany
index f31049b2f..638f796f4 100644
--- a/lib/contrib/gvdb/README.epiphany
+++ b/lib/contrib/gvdb/README.epiphany
@@ -6,5 +6,5 @@ GVariant Database
  * Add clang ifdef guards (#ifndef __clang_analyzer__) around:
    - file_builder_allocate_for_hash
    - file_builder_add_hash
-
- * Removed G_FILE_CREATE_REPLACE_DESTINATION in gvdb_table_write_contents_async
\ No newline at end of file
+ * Removed G_FILE_CREATE_REPLACE_DESTINATION in gvdb_table_write_contents_async
+ * Fix valgrind warnings (gvdb#2)
diff --git a/lib/contrib/gvdb/gvdb-builder.c b/lib/contrib/gvdb/gvdb-builder.c
index 0ac6db01f..5f59e7cb3 100644
--- a/lib/contrib/gvdb/gvdb-builder.c
+++ b/lib/contrib/gvdb/gvdb-builder.c
@@ -340,6 +340,8 @@ file_builder_allocate_for_hash (FileBuilder            *fb,
 #undef chunk
 
   memset (*bloom_filter, 0, n_bloom_words * sizeof (guint32_le));
+  memset (*hash_buckets, 0, n_buckets * sizeof (guint32_le));
+  memset (*hash_items, 0, n_items * sizeof (struct gvdb_hash_item));
 
   /* NOTE - the code to actually fill in the bloom filter here is missing.
    * Patches welcome!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]