Skip to content

Commit 73936ba

Browse files
authored
Merge pull request #472 from secure-software-engineering/f-FixDanglingPointerInIDESolver
Fix Dangling Pointer in IDESolver
2 parents 45dde51 + 563b5c2 commit 73936ba

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/IDESolver.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,8 @@ class IDESolver
892892
for (n_t n : Values) {
893893
for (n_t SP : ICF->getStartPointsOf(ICF->getFunctionOf(n))) {
894894
using TableCell = typename Table<d_t, d_t, EdgeFunctionPtrType>::Cell;
895-
Table<d_t, d_t, EdgeFunctionPtrType> LookupByTarget;
896-
LookupByTarget = JumpFn->lookupByTarget(n);
895+
Table<d_t, d_t, EdgeFunctionPtrType> &LookupByTarget =
896+
JumpFn->lookupByTarget(n);
897897
for (const TableCell &SourceValTargetValAndFunction :
898898
LookupByTarget.cellSet()) {
899899
d_t dPrime = SourceValTargetValAndFunction.getRowKey();
@@ -1098,7 +1098,9 @@ class IDESolver
10981098
// return site using the composed function
10991099
auto RevLookupResult = JumpFn->reverseLookup(c, d4);
11001100
if (RevLookupResult) {
1101-
for (const auto &ValAndFunc : RevLookupResult->get()) {
1101+
llvm::SmallVector<std::pair<d_t, EdgeFunctionPtrType>, 2> ResCopy(
1102+
RevLookupResult->get().begin(), RevLookupResult->get().end());
1103+
for (const auto &ValAndFunc : ResCopy) {
11021104
EdgeFunctionPtrType f3 = ValAndFunc.second;
11031105
if (!f3->equal_to(AllTop)) {
11041106
d_t d3 = ValAndFunc.first;

include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Solver/JumpFunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ template <typename AnalysisDomainTy, typename Container> class JumpFunctions {
169169
* The return value is a set of records of the form
170170
* (sourceVal,targetVal,edgeFunction).
171171
*/
172-
Table<d_t, d_t, EdgeFunctionPtrType> lookupByTarget(n_t Target) {
172+
Table<d_t, d_t, EdgeFunctionPtrType> &lookupByTarget(n_t Target) {
173173
return NonEmptyLookupByTargetNode[Target];
174174
}
175175

0 commit comments

Comments
 (0)