Commit b23455db authored by Dominik Charousset's avatar Dominik Charousset

Fix UB in scribe::consume

parent 9f269a78
......@@ -75,7 +75,6 @@ protected:
/// Detaches this manager from `ptr`.
virtual void detach_from(abstract_broker* ptr) = 0;
private:
strong_actor_ptr parent_;
};
......
......@@ -47,6 +47,9 @@ void scribe::consume(execution_unit* ctx, const void*, size_t num_bytes) {
// further activities for the broker
return;
}
// keep a strong reference to our parent until we leave scope
// to avoid UB when becoming detached during invocation
auto guard = parent_;
auto& buf = rd_buf();
CAF_ASSERT(buf.size() >= num_bytes);
// make sure size is correct, swap into message, and then call client
......
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