Calling returned closures cause segfault #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When calling a closure that has been returned from a function, a segmentation fault happens.
This is because the closure inherits then function's environment, which gets automatically destroyed as soon as the function body has been evaluated. So when the closure is called, a use-after-free bug happens when accessing it's environment.
Reproducible example: