Commit d90a8554 authored by Dominik Charousset's avatar Dominik Charousset

Fix possible heap-use-after-free w/ trace logging

parent 2a3d7126
...@@ -485,6 +485,9 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) { ...@@ -485,6 +485,9 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
} }
//intrusive_ptr<local_actor> mself{this}; //intrusive_ptr<local_actor> mself{this};
std::thread([hide](intrusive_ptr<local_actor> mself) { std::thread([hide](intrusive_ptr<local_actor> mself) {
// this extra scope makes sure that the trace logger is
// destructed before dec_detached_threads() is called
{
CAF_PUSH_AID(mself->id()); CAF_PUSH_AID(mself->id());
CAF_LOGF_TRACE(""); CAF_LOGF_TRACE("");
auto max_throughput = std::numeric_limits<size_t>::max(); auto max_throughput = std::numeric_limits<size_t>::max();
...@@ -494,6 +497,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) { ...@@ -494,6 +497,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
CAF_ASSERT(mself->mailbox().blocked() == false); CAF_ASSERT(mself->mailbox().blocked() == false);
} }
mself.reset(); mself.reset();
}
if (!hide) { if (!hide) {
scheduler::dec_detached_threads(); scheduler::dec_detached_threads();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment