[Issue 23445] Can leak scope variable through delegate context
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 1 18:58:13 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23445
--- Comment #6 from timon.gehr at gmx.ch ---
The delegate context is allocated on the heap. There is a `scope int* p` in
that context, and this pointer points to the stack variable `x`.
`qux` uses `foo` to escape a pointer to the local stack variable `x`. The
delegate context is not even being referenced anymore when the UB happens.
`foo` is just a device that allows `scope`-laundering an arbitrary pointer.
`scope` pointer in, non-`scope` pointer out.
--
More information about the Digitalmars-d-bugs
mailing list