Commit d90a8554 authored by Dominik Charousset's avatar Dominik Charousset

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

parent 2a3d7126
...@@ -485,15 +485,19 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) { ...@@ -485,15 +485,19 @@ 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) {
CAF_PUSH_AID(mself->id()); // this extra scope makes sure that the trace logger is
CAF_LOGF_TRACE(""); // destructed before dec_detached_threads() is called
auto max_throughput = std::numeric_limits<size_t>::max(); {
while (mself->resume(nullptr, max_throughput) != resumable::done) { CAF_PUSH_AID(mself->id());
// await new data before resuming actor CAF_LOGF_TRACE("");
mself->await_data(); auto max_throughput = std::numeric_limits<size_t>::max();
CAF_ASSERT(mself->mailbox().blocked() == false); while (mself->resume(nullptr, max_throughput) != resumable::done) {
// await new data before resuming actor
mself->await_data();
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