[Bug libstdc++/81891] [5/6/7/8 Regression] heap-use-after-free if inserting element in std::unordered_map(InputIt, InputIt) throws
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 18 18:13:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81891
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this might be all we need to do to fix it:
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -973,17 +973,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_bucket_count = __bkt_count;
}
- __try
- {
- for (; __f != __l; ++__f)
- this->insert(*__f);
- }
- __catch(...)
- {
- clear();
- _M_deallocate_buckets();
- __throw_exception_again;
- }
+ for (; __f != __l; ++__f)
+ this->insert(*__f);
}
template<typename _Key, typename _Value,
More information about the Gcc-bugs
mailing list