Skip to content

Commit 3dcab80

Browse files
committed
fix(irdec): use after free when decompiling without debug info
1 parent 701e5cc commit 3dcab80

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/IRDec/ModuleLifter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ModuleLifter {
5050
if (!func.isDeclaration()
5151
&& func.getLinkage() == llvm::Function::ExternalLinkage) {
5252
types::Ty type;
53-
llvm::StringRef funcName = func.getName();
53+
llvm::StringRef funcName;
5454
if (auto subprogram = func.getSubprogram()) {
5555
type = diTypeLifter.lift(subprogram->getType());
5656
funcName = copyString(
@@ -59,6 +59,10 @@ class ModuleLifter {
5959
);
6060
} else {
6161
type = typeLifter.lift(func.getFunctionType());
62+
funcName = copyString(
63+
func.getName(),
64+
_astContext.getASTMemoryArena().getAllocator()
65+
);
6266
}
6367
auto funcType
6468
= llvm::dyn_cast_if_present<glu::types::FunctionTy>(type);

0 commit comments

Comments
 (0)