mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-03 11:08:32 +00:00
Fix a latent UAF bug in profwriter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256116 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
116cc72ed4
commit
cb4197f621
@ -108,6 +108,8 @@ std::error_code InstrProfWriter::addRecord(InstrProfRecord &&I,
|
||||
if (NewFunc) {
|
||||
// We've never seen a function with this name and hash, add it.
|
||||
Dest = std::move(I);
|
||||
// Fix up the name to avoid dangling reference.
|
||||
Dest.Name = FunctionData.find(Dest.Name)->getKey();
|
||||
Result = instrprof_error::success;
|
||||
if (Weight > 1) {
|
||||
for (auto &Count : Dest.Counts) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user