Skip to content

Commit 1a42e7a

Browse files
committed
ews: add missing locking for concurrent EWSPlugin::unsubscribe invocation
``` =21176==ERROR: AddressSanitizer: heap-buffer-overflow .. READ of size 8 line numbers relative to commit ad84c9f f0 std::string::size() const f1 unsigned long FNV::operator()<std::string>(std::string const&) exch/ews/ews.cpp:1170 f2 FNV& FNV::operator<< <std::string>(std::string const&) exch/ews/hash.hpp:101 f3 FNV::FNV<std::string, unsigned int>(std::string const&, unsigned int const&) exch/ews/hash.hpp:48 f4 std::hash<ExmdbSubscriptionKey>::operator()(ExmdbSubscriptionKey const&) const exch/ews/ews.cpp:1185 f5 std::__detail::_Hash_code_base<ExmdbSubscriptionKey>::_M_hash_code(ExmdbSubscriptionKey const&) const f6 std::__detail::_Hash_code_base<ExmdbSubscriptionKey>::_M_bucket_index(std::__detail::_Hash_node_value<std::pair<ExmdbSubscriptionKey const, unsigned int>, false> const&, unsigned long) const f7 std::_Hashtable<ExmdbSubscriptionKey>::_M_bucket_index(std::__detail::_Hash_node_value<std::pair<ExmdbSubscriptionKey const, unsigned int>, false> const&) const f8 std::_Hashtable<ExmdbSubscriptionKey>::_M_erase(unsigned long, std::__detail::_Hash_node_base*, std::__detail::_Hash_node<std::pair<ExmdbSubscriptionKey const, unsigned int>, false>*) f9 std::_Hashtable<ExmdbSubscriptionKey>::_M_erase(std::integral_constant<bool, true>, ExmdbSubscriptionKey const&) f10 std::_Hashtable<ExmdbSubscriptionKey>::erase(ExmdbSubscriptionKey const&) f11 std::unordered_map<ExmdbSubscriptionKey, unsigned int>::erase(ExmdbSubscriptionKey const&) f12 EWSPlugin::unsubscribe(ExmdbSubscriptionKey const&) const exch/ews/ews.cpp:1084 f13 EWSPlugin::SubManager::~SubManager() exch/ews/ews.cpp:766 f14 void std::destroy_at(EWSPlugin::SubManager*) f15 void std::_Destroy(EWSPlugin::SubManager*) f16 void std::allocator_traits::destroy(std::allocator<void>&, EWSPlugin::SubManager*) f17 std::_Sp_counted_ptr_inplace<EWSPlugin::SubManager>::_M_dispose() f18 std::_Sp_counted_base::_M_release() f19 std::__shared_count::~__shared_count() f20 std::__shared_ptr<EWSPlugin::SubManager>::~__shared_ptr() f21 std::shared_ptr<EWSPlugin::SubManager>::~shared_ptr() f22 EWSPlugin::unsubscribe(unsigned int, char const*) const exch/ews/ews.cpp:1073 f23 EWSContext::unsubscribe(Structures::tSubscriptionId const&) const exch/ews/context.cpp:2618 f24 EWSContext::~EWSContext() exch/ews/context.cpp:393 f25 std::default_delete::operator()(EWSContext*) const f26 std::__uniq_ptr_impl::reset(EWSContext*) f27 std::unique_ptr::reset(EWSContext*) f28 EWSPlugin::term(int) exch/ews/ews.cpp:726 f29 operator() exch/ews/ews.cpp:561 f30 _FUN exch/ews/ews.cpp:561 f31 hpm_processor_insert_ctx(http_context*) exch/http/hpm_processor.cpp:501 f32 wrrep_nobuf exch/http/http_parser.cpp:1525 f33 wrrep exch/http/http_parser.cpp:1617 f34 http_parser_process(schedule_context*) exch/http/http_parser.cpp:2217 f35 tpol_thrwork lib/threads_pool.cpp:201 ``` References: GXL-503, GXL-648, DESK-4196
1 parent 061aefa commit 1a42e7a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

exch/ews/ews.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,10 @@ bool EWSPlugin::unsubscribe(detail::SubscriptionKey subscriptionKey,
10791079
*/
10801080
void EWSPlugin::unsubscribe(const detail::ExmdbSubscriptionKey& key) const
10811081
{
1082-
subscriptions.erase(key);
1082+
{
1083+
std::unique_lock lk(subscriptionLock);
1084+
subscriptions.erase(key);
1085+
}
10831086
exmdb.unsubscribe_notification(key.first.c_str(), key.second);
10841087
}
10851088

0 commit comments

Comments
 (0)