From 782ee8cf89bc6dea6c2f5e91b5bd42e2b4c2a725 Mon Sep 17 00:00:00 2001 From: Aaron Councilman <aaronjc4@illinois.edu> Date: Mon, 18 Apr 2022 20:01:06 -0500 Subject: [PATCH] Fix use-after-free bug in Hetero-C++ --- hpvm/projects/hetero-c++/lib/HPVMExtractTask.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hpvm/projects/hetero-c++/lib/HPVMExtractTask.cpp b/hpvm/projects/hetero-c++/lib/HPVMExtractTask.cpp index 0edd768a3f..095b77dcbd 100644 --- a/hpvm/projects/hetero-c++/lib/HPVMExtractTask.cpp +++ b/hpvm/projects/hetero-c++/lib/HPVMExtractTask.cpp @@ -2971,12 +2971,10 @@ CallInst* HPVMProgram::parallelizeLoop(/*Loop* ExtractedLoop, Loop* InnerLoop*/ InductionVar->replaceUsesWithIf(MatchedType, shouldReplaceIV); + IntegerType* LimTy = dyn_cast<IntegerType>(InductionVar->getType()); cast<Instruction>(InductionVar)->eraseFromParent(); - - - IntegerType* LimTy = dyn_cast<IntegerType>(InductionVar->getType()); assert(LimTy && "Loop bounds must be of integer type"); Value* MatchedLimitType = castIntegerToBitwidth(getNumCall, getNumCall->getNextNode(), LimTy->getBitWidth()); -- GitLab