Re: Invalid memory read in io_context::executor_type::post
Steve Gerbino via Boost <[email protected]> Mon, 29 Jun 2026 18:49:50 +0000
| Newsgroups | gmane.comp.lib.boost.devel |
|---|---|
| Message-ID | <yt-HAoNTS5sae2uro39AOWQJDzEfje8pjBB2IwwX_jt8K0U1Y9SRIWQ9LN04YUsaEADwD4UCWkRafv8qRN-lthH8591qko3F1-gjuL1C0iM=@gerbino.co> |
On Monday, June 29th, 2026 at 8:24 PM, Ruben Perez via Boost <[email protected]> wrote: > Hi all, > > The continuation version of io_context::executor_type::post [1] seems > to cause an invalid read when submitting operations that don't inherit > from continuation_op. try_from_continuation [2] will attempt to read a > magic number. In continuation_op, the magic is before the continuation > member [3]. If the submitted operation doesn't inherit from > continuation_op, this leads to reading potentially unmapped memory. > > Reproducer (build with -fsanitize=address): > > struct my_awaitable { > capy::continuation* cont; > > bool await_ready() const { return false; } > std::coroutine_handle<> await_suspend( > std::coroutine_handle<> h, > capy::io_env const* env) noexcept > { > cont->h = h; > env->executor.post(*cont); > return std::noop_coroutine(); > } > > int await_resume() const { return 42; } > }; > > capy::task<void> co_main() > { > auto cont = std::make_unique<capy::continuation>(); > my_awaitable aw{cont.get()}; > int v = co_await aw; > std::cout << "The value is: " << v << std::endl; > } > > I've also raised an issue in the repo [4]. I'll have a look at the issue now. Fix will likely land in develop-2. _______________________________________________ Boost mailing list -- [email protected] To unsubscribe send an email to [email protected] https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/[email protected]/message/PZIK5NVLAY6AMC67IPTVPQQKZJNJEVTK/