[PATCH] D146412: [NFC] Fix potential use-after-free in DumpModuleInfoAction::ExecuteAction()
Mariya Podchishchaeva via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 28 08:35:01 PDT 2023
Fznamznon added a comment.
> Should OutputStream be made into a shared_ptr so we can clarify the memory ownership instead of leaving it as a raw pointer? That should also address the use-after-free.
Well, I was thinking about that and wasn't sure about it either. https://reviews.llvm.org/D129456 added initialization of `OutputStream` from the outside. When last shared_ptr is destroyed, it destroys undelying object as well. In case underlying object came from the outside in a form of raw pointer, we may end up accidentally deleting it when DumpModuleInfoAction is destroyed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146412/new/
https://reviews.llvm.org/D146412
More information about the cfe-commits
mailing list