[PATCH] D41374: [Coverage] Fix use-after free in coverage emission
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 18 17:55:05 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL321052: [Coverage] Fix use-after free in coverage emission (authored by efriedma, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D41374?vs=127440&id=127451#toc
Repository:
rL LLVM
https://reviews.llvm.org/D41374
Files:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -4289,7 +4289,11 @@
}
void CodeGenModule::EmitDeferredUnusedCoverageMappings() {
- for (const auto &Entry : DeferredEmptyCoverageMappingDecls) {
+ // We call takeVector() here to avoid use-after-free.
+ // FIXME: DeferredEmptyCoverageMappingDecls is getting mutated because
+ // we deserialize function bodies to emit coverage info for them, and that
+ // deserializes more declarations. How should we handle that case?
+ for (const auto &Entry : DeferredEmptyCoverageMappingDecls.takeVector()) {
if (!Entry.second)
continue;
const Decl *D = Entry.first;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41374.127451.patch
Type: text/x-patch
Size: 788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171219/c10d3cc8/attachment.bin>
More information about the cfe-commits
mailing list