diff options
author | François Dumont <fdumont@gcc.gnu.org> | 2023-10-18 19:35:32 +0200 |
---|---|---|
committer | François Dumont <fdumont@gcc.gnu.org> | 2023-10-19 19:06:08 +0200 |
commit | c714b4d30d229e2b21064f0ce1e2fa3259fe06c0 (patch) | |
tree | 6063a2b19e820dab3a40e56f0f27f575e904bce1 /gcc/cp/constexpr.cc | |
parent | 2454ba9e2d1ce2d1b9b2b46f6111e022364bf9b5 (diff) | |
download | gcc-c714b4d30d229e2b21064f0ce1e2fa3259fe06c0.zip gcc-c714b4d30d229e2b21064f0ce1e2fa3259fe06c0.tar.gz gcc-c714b4d30d229e2b21064f0ce1e2fa3259fe06c0.tar.bz2 |
libstdc++: [_Hashtable] Do not reuse untrusted cached hash code
On merge, reuse a merged node's possibly cached hash code only if we are on the
same type of hash and this hash is stateless.
Usage of function pointers or std::function as hash functor will prevent reusing
cached hash code.
libstdc++-v3/ChangeLog
* include/bits/hashtable_policy.h
(_Hash_code_base::_M_hash_code(const _Hash&, const _Hash_node_value<>&)): Remove.
(_Hash_code_base::_M_hash_code<_H2>(const _H2&, const _Hash_node_value<>&)): Remove.
* include/bits/hashtable.h
(_M_src_hash_code<_H2>(const _H2&, const key_type&, const __node_value_type&)): New.
(_M_merge_unique<>, _M_merge_multi<>): Use latter.
* testsuite/23_containers/unordered_map/modifiers/merge.cc
(test04, test05, test06): New test cases.
Diffstat (limited to 'gcc/cp/constexpr.cc')
0 files changed, 0 insertions, 0 deletions