Skip to content

Commit 8b2ecdb

Browse files
authored
Merge pull request #64467 from adrian-prantl/use-after-free-name
Fix a use-after-free in IRGenSIL.
2 parents 8081d87 + 0fa64b5 commit 8b2ecdb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,10 +1104,10 @@ class IRGenSILFunction :
11041104
llvm::Value *Shape = emitPackShapeExpression(t);
11051105
if (PackShapeExpressions.insert(Shape).second) {
11061106
llvm::SmallString<8> Buf;
1107-
llvm::raw_svector_ostream OS(Buf);
11081107
unsigned Position = PackShapeExpressions.size() - 1;
1109-
OS << "$pack_count_" << Position;
1110-
SILDebugVariable Var(OS.str(), true, 0);
1108+
llvm::raw_svector_ostream(Buf) << "$pack_count_" << Position;
1109+
auto Name = IGM.Context.getIdentifier(Buf.str());
1110+
SILDebugVariable Var(Name.str(), true, 0);
11111111
Shape = emitShadowCopyIfNeeded(Shape, getDebugScope(), Var, false,
11121112
false /*was move*/);
11131113
if (IGM.DebugInfo)

0 commit comments

Comments
 (0)