[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Oct 30 06:22:01 UTC 2018


 src/hb-map.hh    |    4 ++--
 src/hb-object.hh |    1 +
 src/hb-set.hh    |    4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit b186274362725b7501211c2a782c1a0badd57107
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Oct 29 23:21:14 2018 -0700

    [set/map] Fix uninitialized memory
    
    I keep forgetting that primitive types are NOT initialized during construction. :|

diff --git a/src/hb-map.hh b/src/hb-map.hh
index e5ca3f51..c54c9d7b 100644
--- a/src/hb-map.hh
+++ b/src/hb-map.hh
@@ -45,8 +45,8 @@ inline uint32_t Hash (const T &v)
 struct hb_map_t
 {
   HB_NO_COPY_ASSIGN (hb_map_t);
-  inline hb_map_t (void) { init_shallow (); }
-  inline ~hb_map_t (void) { fini_shallow (); }
+  inline hb_map_t (void) { init (); }
+  inline ~hb_map_t (void) { fini (); }
 
   struct item_t
   {
diff --git a/src/hb-object.hh b/src/hb-object.hh
index d347b5ff..106f5920 100644
--- a/src/hb-object.hh
+++ b/src/hb-object.hh
@@ -272,6 +272,7 @@ static inline void hb_object_fini (Type *obj)
   {
     user_data->fini ();
     free (user_data);
+    user_data = nullptr;
   }
 }
 template <typename Type>
diff --git a/src/hb-set.hh b/src/hb-set.hh
index 97ff291e..0755498b 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -40,8 +40,8 @@
 struct hb_set_t
 {
   HB_NO_COPY_ASSIGN (hb_set_t);
-  inline hb_set_t (void) { init_shallow (); }
-  inline ~hb_set_t (void) { fini_shallow (); }
+  inline hb_set_t (void) { init (); }
+  inline ~hb_set_t (void) { fini (); }
 
   struct page_map_t
   {


More information about the HarfBuzz mailing list