Fix msan issue
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 8 May 2019 23:16:43 +0000 (16:16 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 8 May 2019 23:16:43 +0000 (16:16 -0700)
hb_identity returns rvalue-reference if input is rvalue.  That, can leak
the reference and cause in bad access to temporaries after they are
destructed.  This is unfortunately unfixable given the desired
transparency of hb_identity :(.  Just don't use it with hb_map().

src/test-iter.cc

index 0a0e4d1..944c234 100644 (file)
@@ -161,7 +161,7 @@ main (int argc, char **argv)
   test_iterator_non_default_constructable (hb_enumerate (hb_iter (st)));
   test_iterator_non_default_constructable (hb_enumerate (hb_iter (st) + 1));
   test_iterator_non_default_constructable (hb_iter (st) | hb_filter ());
-  test_iterator_non_default_constructable (hb_iter (st) | hb_map (hb_identity));
+  test_iterator_non_default_constructable (hb_iter (st) | hb_map (hb_rvalue));
 
   assert (true == hb_all (st));
   assert (false == hb_all (st, 42u));