Commit Graph

9178 Commits

Author SHA1 Message Date
Behdad Esfahbod afb013f350 Fix msan issue
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().
2019-05-08 16:16:43 -07:00
Behdad Esfahbod 4c94bc63d9 Move hb_invoke() back to hb-algs.hh 2019-05-08 15:57:33 -07:00
Behdad Esfahbod b710176ce2 [hdmx] Touch up 2019-05-08 15:47:24 -07:00
Garret Rieger e8ef0e627c [subset] WIP convert hdmx subsetting to use iterators. 2019-05-08 15:47:24 -07:00
Garret Rieger d5decf9bf7 [subset] Move hdmx to subset2. 2019-05-08 15:47:24 -07:00
Behdad Esfahbod 27b2093009 [map] Return rvalues from keys()/values() 2019-05-08 15:32:57 -07:00
Behdad Esfahbod 372c5b97bf [map] Fix bots
Older compilers don't like calling iter() from return-type decltype()

../src/hb-map.hh:226:12: error: cannot call member function 'decltype ((((+ hb_array(((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::items, (((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::mask ? (((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::mask + 1) : 0))) | hb_filter((& hb_hashmap_t<K, V, kINVALID, vINVALID>::item_t:: is_real))) | hb_map((& hb_hashmap_t<K, V, kINVALID, vINVALID>::item_t:: get_pair)))) hb_hashmap_t<K, V, kINVALID, vINVALID>::iter() const [with K = const hb_serialize_context_t::object_t*; V = unsigned int; K kINVALID = 0u; V vINVALID = 0u; decltype ((((+ hb_array(((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::items, (((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::mask ? (((const hb_hashmap_t<K, V, kINVALID, vINVALID>*)this)->hb_hashmap_t<K, V, kINVALID, vINVALID>::mask + 1) : 0))) | hb_filter((& hb_hashmap_t<K, V, kINVALID, vINVALID>::item_t:: is_real))) | hb_map((& hb_hashmap_t<K, V, kINVALID, vINVALID>::item_t:: get_pair)))) = hb_map_iter_t<hb_filter_iter_t<hb_array_t<hb_hashmap_t<const hb_serialize_context_t::object_t*, unsigned int, 0u, 0u>::item_t>, bool (hb_hashmap_t<const hb_serialize_context_t::object_t*, unsigned int, 0u, 0u>::item_t::*)() const, const<anonymous struct>&, 0u>, hb_pair_t<const hb_serialize_context_t::object_t*, unsigned int> (hb_hashmap_t<const hb_serialize_context_t::object_t*, unsigned int, 0u, 0u>::item_t::*)() const, 0u>]' without object
     + iter()
            ^
../src/hb-meta.hh:58:41: note: in definition of macro 'HB_AUTO_RETURN'
 #define HB_AUTO_RETURN(E) -> decltype ((E)) { return (E); }
                                         ^
2019-05-08 15:28:39 -07:00
Behdad Esfahbod a304827184 [map] Add .values() iterator 2019-05-08 15:08:33 -07:00
Behdad Esfahbod 3c69505b3a [map] Fix iter 2019-05-08 15:08:33 -07:00
Behdad Esfahbod 5ceaafa5de [algs] Fix identity return type 2019-05-08 15:08:33 -07:00
Behdad Esfahbod f5705d7656 Whitespace 2019-05-08 15:08:33 -07:00
Behdad Esfahbod a17f0fa3a1 [meta] Capture rvalue-references in is_reference / remove_reference 2019-05-08 15:08:33 -07:00
Behdad Esfahbod 7166bd5634 Minor 2019-05-08 15:08:33 -07:00
rsheeter b827181ba1 [map] tweak test-iter.cc 2019-05-08 15:08:33 -07:00
rsheeter 492af0f1bf [map] add keys() 2019-05-08 15:08:33 -07:00
rsheeter ba60512813 [map] add a test for iteration 2019-05-08 15:08:33 -07:00
rsheeter 183b8094b5 [map] add iteration 2019-05-08 15:08:33 -07:00
Ebrahim Byagowi df237d2fe7
[test] Add https://crbug.com/oss-fuzz/14641 testcase
As 503748d fix
2019-05-08 14:17:14 -07:00
Michiharu Ariza 02ae2591d9 initialize return param subr_num in popSubrNum
also snake_cased popSubrtNum and other surrounding function names
2019-05-08 13:44:03 -07:00
Behdad Esfahbod 503748d8a8 [name] Sanitize records for reals
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14641
2019-05-08 12:45:02 -07:00
Behdad Esfahbod 5875d775e1 [iter] Rename hb_iter_t() to hb_iter_type<> and add hb_item_type<> 2019-05-08 12:28:46 -07:00
Behdad Esfahbod bad1606639 [map] Make .has() optionally return value 2019-05-08 12:11:52 -07:00
Behdad Esfahbod 750d5af48e Make compiler happy with -Og 2019-05-08 12:10:00 -07:00
Behdad Esfahbod cdb61eb043 [iter] Accept pointer in hb_iter() and hb_iter_t() 2019-05-08 11:00:18 -07:00
Behdad Esfahbod c93eeba9b2 [iter] Accept pointer in hb_map() 2019-05-08 10:56:09 -07:00
Behdad Esfahbod 4c9e0c37a3 [serialize] LangSys subset->copy 2019-05-08 10:40:39 -07:00
Behdad Esfahbod 50dc3e7d9f Add hb_iota() 2019-05-08 10:35:02 -07:00
Behdad Esfahbod aa4ac13f0b [iter] Actually fix previous commit
The iter objects shouldn't not be const.  D'oh.
2019-05-08 10:03:10 -07:00
Behdad Esfahbod a66598e030 [iter] For ref-qualified variants 2019-05-08 10:03:10 -07:00
rsheeter fa576ce187
Update README.md 2019-05-08 09:53:58 -07:00
rsheeter d109c9e767
Update README.md 2019-05-08 09:53:29 -07:00
rsheeter 4063181791 [docs] add fuzzer instructions (courtesy of Garret) 2019-05-08 09:50:42 -07:00
Roderick Sheeter 00946ca3aa [docs] add sample commands for test exec 2019-05-08 09:50:42 -07:00
Behdad Esfahbod 8479eb5955 [iter] Fix hb_sink() to accept rvalue 2019-05-08 09:48:55 -07:00
Behdad Esfahbod 710d459aca [iter] Default predicates to hb_identity instead of hb_bool
The bool conversion happens after predicate is called automatically.
2019-05-08 09:33:09 -07:00
Behdad Esfahbod fe14a4000a Adjust hb_all/any/none 2019-05-08 09:32:19 -07:00
Behdad Esfahbod 4a101d8ffc Add hb_match 2019-05-08 09:16:33 -07:00
Behdad Esfahbod 26adefd9ea [algs] Try f[v] in hb_get() as last resort 2019-05-08 09:14:44 -07:00
Behdad Esfahbod 0601a19d38 Fix a few more double-pomotion errors 2019-05-08 07:47:36 -07:00
Behdad Esfahbod 2ba984fcbb Fix signed comparison on 32bit 2019-05-07 23:28:22 -07:00
Behdad Esfahbod dfc5780245 Fix more double-promotion errors
WHy do only some of the clang bots catch this I have no idea :(.
2019-05-07 23:26:09 -07:00
Behdad Esfahbod c2c9d204fa Fix double-promotion warnings
Make it an error.
2019-05-07 23:13:38 -07:00
Behdad Esfahbod 2c7093ed01 More tests 2019-05-07 23:10:59 -07:00
Behdad Esfahbod 56d2d0294b [algs] Sprinkle hb_min/max with hb-forward salad
Let's see if fixes MSVC fail.  Though, the error doesn't make sense to me.

  hb-blob.cc
c:\projects\harfbuzz\src\hb-algs.hh(166): error C2440: 'return': cannot convert from 'unsigned int' to 'unsigned int &&' [C:\projects\harfbuzz\build\harfbuzz.vcxproj]
  c:\projects\harfbuzz\src\hb-algs.hh(166): note: You cannot bind an lvalue to an rvalue reference
  c:\projects\harfbuzz\src\hb-algs.hh(174): note: see reference to function template instantiation 'T &&<unnamed-type-hb_min>::impl<T,unsigned int&>(T &&,T2) const' being compiled
          with
          [
              T=unsigned int,
              T2=unsigned int &
          ]
2019-05-07 23:08:49 -07:00
Behdad Esfahbod bdbfdc92b5 [iter] Add value and projection to hb_all/any/none
Allows for eg, checking all values equal 2: hb_all (it, 2).
2019-05-07 23:02:44 -07:00
Behdad Esfahbod cf61acb9ea [iter] Accept rvalues to hb_enumerate() 2019-05-07 22:45:01 -07:00
Behdad Esfahbod e8bd5fc3fa [meta] Move hb_invoke from algs to meta 2019-05-07 22:29:40 -07:00
Behdad Esfahbod af571dbffc [meta] Replace most hb_enable_if with hb_requires
They do absolutely same thing.  hb_requires is to encode constraints,
whereas hb_enable_if is for more conditional enabling.
2019-05-07 21:39:20 -07:00
Behdad Esfahbod 6fa1f38070 [algs] Accept varargs in hb_min/max 2019-05-07 21:33:26 -07:00
Behdad Esfahbod 1ad07080c3 Rename 2019-05-07 21:00:23 -07:00