svf-lib 1.0.2694 → 1.0.2696

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/SVF-linux-x86_64/bin/ae +0 -0
  2. package/SVF-linux-x86_64/bin/cfl +0 -0
  3. package/SVF-linux-x86_64/bin/dvf +0 -0
  4. package/SVF-linux-x86_64/bin/mta +0 -0
  5. package/SVF-linux-x86_64/bin/svf-ex +0 -0
  6. package/SVF-linux-x86_64/bin/wpa +0 -0
  7. package/SVF-linux-x86_64/include/MemoryModel/AbstractPointsToDS.h +6 -0
  8. package/SVF-linux-x86_64/include/MemoryModel/PointerAnalysis.h +4 -0
  9. package/SVF-linux-x86_64/include/MemoryModel/PointerAnalysisImpl.h +4 -0
  10. package/SVF-linux-x86_64/include/WPA/Andersen.h +10 -0
  11. package/SVF-linux-x86_64/lib/libSvfCore.so.3.4 +0 -0
  12. package/SVF-osx/bin/ae +0 -0
  13. package/SVF-osx/bin/mta +0 -0
  14. package/SVF-osx/bin/svf-ex +0 -0
  15. package/SVF-osx/include/AE/Core/AbstractState.h +1 -1
  16. package/SVF-osx/include/AE/Core/AddressValue.h +3 -3
  17. package/SVF-osx/include/AE/Core/IntervalValue.h +64 -64
  18. package/SVF-osx/include/AE/Core/NumericValue.h +44 -44
  19. package/SVF-osx/include/AE/Svfexe/AEDetector.h +7 -7
  20. package/SVF-osx/include/DDA/FlowDDA.h +2 -2
  21. package/SVF-osx/include/Graphs/CDG.h +2 -2
  22. package/SVF-osx/include/Graphs/CHG.h +3 -3
  23. package/SVF-osx/include/Graphs/IRGraph.h +3 -3
  24. package/SVF-osx/include/Graphs/VFG.h +5 -5
  25. package/SVF-osx/include/Graphs/WTO.h +1 -1
  26. package/SVF-osx/include/MTA/LockAnalysis.h +8 -8
  27. package/SVF-osx/include/MTA/MTASVFGBuilder.h +1 -1
  28. package/SVF-osx/include/MemoryModel/AbstractPointsToDS.h +6 -0
  29. package/SVF-osx/include/MemoryModel/ConditionalPT.h +69 -69
  30. package/SVF-osx/include/MemoryModel/MutablePointsToDS.h +33 -33
  31. package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +18 -18
  32. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +4 -0
  33. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +4 -0
  34. package/SVF-osx/include/SABER/SaberCheckerAPI.h +2 -2
  35. package/SVF-osx/include/SVF-LLVM/GEPTypeBridgeIterator.h +11 -11
  36. package/SVF-osx/include/SVF-LLVM/LLVMModule.h +2 -2
  37. package/SVF-osx/include/SVFIR/SVFIR.h +3 -3
  38. package/SVF-osx/include/SVFIR/SVFVariables.h +1 -1
  39. package/SVF-osx/include/Util/CommandLine.h +10 -10
  40. package/SVF-osx/include/Util/SparseBitVector.h +30 -30
  41. package/SVF-osx/include/Util/iterator.h +15 -15
  42. package/SVF-osx/include/WPA/Andersen.h +10 -0
  43. package/SVF-osx/lib/libSvfCore.3.4.dylib +0 -0
  44. package/package.json +1 -1
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -101,6 +101,12 @@ public:
101
101
  return ptdTy;
102
102
  }
103
103
 
104
+ /// Whether we maintain reverse points-to sets.
105
+ inline bool hasReversePts() const
106
+ {
107
+ return rev;
108
+ }
109
+
104
110
  /// Clears all points-to sets as if nothing is stored.
105
111
  virtual void clear() = 0;
106
112
 
@@ -189,6 +189,10 @@ public:
189
189
  /// Interface exposed to users of our pointer analysis, given PAGNodeID
190
190
  virtual AliasResult alias(NodeID node1, NodeID node2) = 0;
191
191
 
192
+ /// Collect the nodes that may alias the given node.
193
+ /// Subclasses must implement this query; the default reports unsupported and aborts.
194
+ virtual NodeBS getMayAliases(NodeID node);
195
+
192
196
  /// Get points-to targets of a pointer. It needs to be implemented in child class
193
197
  virtual const PointsTo& getPts(NodeID ptr) = 0;
194
198
 
@@ -225,6 +225,10 @@ public:
225
225
  /// Interface expose to users of our pointer analysis, given two pts
226
226
  virtual AliasResult alias(const PointsTo& pts1, const PointsTo& pts2);
227
227
 
228
+ /// Declaring the PointsTo overload below would otherwise hide the base class's
229
+ /// mayAlias(NodeID, NodeID) and mayAlias(const SVFVar*, const SVFVar*).
230
+ using PointerAnalysis::mayAlias;
231
+
228
232
  /// Convenience bool wrappers: return true if the two operands may/must/partial alias
229
233
  inline bool mayAlias(const PointsTo& pts1, const PointsTo& pts2)
230
234
  {
@@ -252,6 +252,9 @@ public:
252
252
  return getPTDataTy()->unionPts(id,ptd);
253
253
  }
254
254
 
255
+ /// Collect exactly the SVFIR nodes q for which mayAlias(node, q) holds
256
+ virtual NodeBS getMayAliases(NodeID node);
257
+
255
258
 
256
259
  void dumpTopLevelPtsTo();
257
260
 
@@ -354,6 +357,13 @@ protected:
354
357
  /// SCC detection
355
358
  virtual NodeStack& SCCDetect();
356
359
 
360
+ /// Collect may-alias candidates. Attempts to do so from reverse points-to sets (cheaper),
361
+ /// and if not possible, falls back to trying every node (costlier).
362
+ NodeBS getMayAliasCandidates(NodeID node);
363
+
364
+ /// Also check getMayAliases on the pointers that the alias tests use
365
+ virtual void validateSuccessTests(std::string fun);
366
+
357
367
 
358
368
 
359
369
  /// Sanitize pts for field insensitive objects
package/SVF-osx/bin/ae CHANGED
Binary file
package/SVF-osx/bin/mta CHANGED
Binary file
Binary file
@@ -327,7 +327,7 @@ public:
327
327
  bool operator==(const AbstractState&rhs) const
328
328
  {
329
329
  return eqVarToValMap(_varToAbsVal, rhs.getVarToVal()) &&
330
- eqVarToValMap(_addrToAbsVal, rhs.getLocToVal());
330
+ eqVarToValMap(_addrToAbsVal, rhs.getLocToVal());
331
331
  }
332
332
 
333
333
  bool operator!=(const AbstractState&rhs) const
@@ -176,9 +176,9 @@ public:
176
176
 
177
177
  bool hasIntersect(const AddressValue &other) const
178
178
  {
179
- for (const auto& addr : _addrs)
180
- {
181
- if (other._addrs.count(addr))
179
+ for (const auto& addr : _addrs)
180
+ {
181
+ if (other._addrs.count(addr))
182
182
  return true;
183
183
  }
184
184
  return false;
@@ -150,12 +150,12 @@ public:
150
150
  IntervalValue operator==(const IntervalValue &other) const
151
151
  {
152
152
  if (this->isBottom() || other.isBottom())
153
- {
154
- return bottom();
153
+ {
154
+ return bottom();
155
155
  }
156
156
  else if (this->isTop() || other.isTop())
157
- {
158
- return top();
157
+ {
158
+ return top();
159
159
  }
160
160
  else
161
161
  {
@@ -184,12 +184,12 @@ public:
184
184
  IntervalValue operator!=(const IntervalValue &other) const
185
185
  {
186
186
  if (this->isBottom() || other.isBottom())
187
- {
188
- return bottom();
187
+ {
188
+ return bottom();
189
189
  }
190
190
  else if (this->isTop() || other.isTop())
191
- {
192
- return top();
191
+ {
192
+ return top();
193
193
  }
194
194
  else
195
195
  {
@@ -300,16 +300,16 @@ public:
300
300
  bool containedWithin(const IntervalValue &other) const
301
301
  {
302
302
  if (this->isBottom())
303
- {
304
- return true;
305
- }
306
- else if (other.isBottom())
307
- {
308
- return false;
309
- }
310
- else
311
- {
312
- return other._lb.leq(this->_lb) && this->_ub.leq(other._ub);
303
+ {
304
+ return true;
305
+ }
306
+ else if (other.isBottom())
307
+ {
308
+ return false;
309
+ }
310
+ else
311
+ {
312
+ return other._lb.leq(this->_lb) && this->_ub.leq(other._ub);
313
313
  }
314
314
 
315
315
  }
@@ -321,16 +321,16 @@ public:
321
321
  bool contain(const IntervalValue &other) const
322
322
  {
323
323
  if (this->isBottom())
324
- {
325
- return true;
326
- }
327
- else if (other.isBottom())
328
- {
329
- return false;
330
- }
331
- else
332
- {
333
- return other._lb.geq(this->_lb) && this->_ub.geq(other._ub);
324
+ {
325
+ return true;
326
+ }
327
+ else if (other.isBottom())
328
+ {
329
+ return false;
330
+ }
331
+ else
332
+ {
333
+ return other._lb.geq(this->_lb) && this->_ub.geq(other._ub);
334
334
  }
335
335
  }
336
336
 
@@ -339,16 +339,16 @@ public:
339
339
  bool leq(const IntervalValue &other) const
340
340
  {
341
341
  if (this->isBottom())
342
- {
343
- return true;
344
- }
345
- else if (other.isBottom())
346
- {
347
- return false;
348
- }
349
- else
350
- {
351
- return this->_ub.leq(other._lb);
342
+ {
343
+ return true;
344
+ }
345
+ else if (other.isBottom())
346
+ {
347
+ return false;
348
+ }
349
+ else
350
+ {
351
+ return this->_ub.leq(other._lb);
352
352
  }
353
353
  }
354
354
 
@@ -357,16 +357,16 @@ public:
357
357
  bool geq(const IntervalValue &other) const
358
358
  {
359
359
  if (this->isBottom())
360
- {
361
- return true;
362
- }
363
- else if (other.isBottom())
364
- {
365
- return false;
366
- }
367
- else
368
- {
369
- return this->_lb.geq(other._ub);
360
+ {
361
+ return true;
362
+ }
363
+ else if (other.isBottom())
364
+ {
365
+ return false;
366
+ }
367
+ else
368
+ {
369
+ return this->_lb.geq(other._ub);
370
370
  }
371
371
  }
372
372
 
@@ -375,16 +375,16 @@ public:
375
375
  bool equals(const IntervalValue &other) const
376
376
  {
377
377
  if (this->isBottom())
378
- {
379
- return other.isBottom();
378
+ {
379
+ return other.isBottom();
380
380
  }
381
381
  else if (other.isBottom())
382
- {
383
- return false;
384
- }
385
- else
386
- {
387
- if (this->is_real() && other.is_real())
382
+ {
383
+ return false;
384
+ }
385
+ else
386
+ {
387
+ if (this->is_real() && other.is_real())
388
388
  {
389
389
  return this->_lb.equal(other._lb) && this->_ub.equal(other._ub);
390
390
  }
@@ -500,16 +500,16 @@ public:
500
500
  void dump(std::ostream &o) const
501
501
  {
502
502
  if (this->isBottom())
503
- {
504
- o << "⊥";
505
- }
506
- else
507
- {
508
- o << "[" << this->_lb << ", " << this->_ub << "]";
503
+ {
504
+ o << "⊥";
505
+ }
506
+ else
507
+ {
508
+ o << "[" << this->_lb << ", " << this->_ub << "]";
509
+ }
509
510
  }
510
- }
511
511
 
512
- const std::string toString() const
512
+ const std::string toString() const
513
513
  {
514
514
  std::string str;
515
515
  std::stringstream rawStr(str);
@@ -163,8 +163,8 @@ public:
163
163
  {
164
164
  // If only one of the two BoundedInts is infinite.
165
165
  if (is_infinity() ^ rhs.is_infinity())
166
- {
167
- if (is_infinity())
166
+ {
167
+ if (is_infinity())
168
168
  {
169
169
  return is_minus_infinity();
170
170
  }
@@ -175,8 +175,8 @@ public:
175
175
  }
176
176
  // If both BoundedInts are infinite.
177
177
  if (is_infinity() && rhs.is_infinity())
178
- {
179
- if (is_minus_infinity())
178
+ {
179
+ if (is_minus_infinity())
180
180
  return true;
181
181
  else
182
182
  return rhs.is_plus_infinity();
@@ -184,15 +184,15 @@ public:
184
184
  // If neither BoundedInt is infinite.
185
185
  else
186
186
  return _iVal <= rhs._iVal;
187
- }
187
+ }
188
188
 
189
189
  // Checks if the BoundedInt is greater than or equal to another BoundedInt.
190
190
  bool geq(const BoundedInt& rhs) const
191
191
  {
192
192
  // If only one of the two BoundedInts is infinite.
193
193
  if (is_infinity() ^ rhs.is_infinity())
194
- {
195
- if (is_infinity())
194
+ {
195
+ if (is_infinity())
196
196
  {
197
197
  return is_plus_infinity();
198
198
  }
@@ -203,8 +203,8 @@ public:
203
203
  }
204
204
  // If both BoundedInts are infinite.
205
205
  if (is_infinity() && rhs.is_infinity())
206
- {
207
- if (is_plus_infinity())
206
+ {
207
+ if (is_plus_infinity())
208
208
  return true;
209
209
  else
210
210
  return rhs.is_minus_infinity();
@@ -212,7 +212,7 @@ public:
212
212
  // If neither BoundedInt is infinite.
213
213
  else
214
214
  return _iVal >= rhs._iVal;
215
- }
215
+ }
216
216
 
217
217
  /// Reload operator
218
218
  //{%
@@ -667,14 +667,14 @@ public:
667
667
  // If the object represents negative infinity, return the minimum
668
668
  // representable 64-bit integer.
669
669
  if (is_minus_infinity())
670
- {
671
- return std::numeric_limits<s64_t>::min();
670
+ {
671
+ return std::numeric_limits<s64_t>::min();
672
672
  }
673
673
  // If the object represents positive infinity, return the maximum
674
674
  // representable 64-bit integer.
675
675
  else if (is_plus_infinity())
676
- {
677
- return std::numeric_limits<s64_t>::max();
676
+ {
677
+ return std::numeric_limits<s64_t>::max();
678
678
  }
679
679
  // Otherwise, return the actual 64-bit integer value of the object.
680
680
  else
@@ -686,20 +686,20 @@ public:
686
686
  inline virtual const std::string to_string() const
687
687
  {
688
688
  if (is_minus_infinity())
689
- {
690
- return "-oo";
691
- }
692
- if (is_plus_infinity())
693
- {
694
- return "+oo";
695
- }
696
- else
697
- return std::to_string(_iVal);
689
+ {
690
+ return "-oo";
691
+ }
692
+ if (is_plus_infinity())
693
+ {
694
+ return "+oo";
695
+ }
696
+ else
697
+ return std::to_string(_iVal);
698
698
  }
699
699
 
700
700
  //%}
701
701
 
702
- bool is_real() const
702
+ bool is_real() const
703
703
  {
704
704
  return false;
705
705
  }
@@ -817,8 +817,8 @@ public:
817
817
  bool leq(const BoundedDouble& rhs) const
818
818
  {
819
819
  if (is_infinity() ^ rhs.is_infinity())
820
- {
821
- if (is_infinity())
820
+ {
821
+ if (is_infinity())
822
822
  {
823
823
  return is_minus_infinity();
824
824
  }
@@ -828,21 +828,21 @@ public:
828
828
  }
829
829
  }
830
830
  if (is_infinity() && rhs.is_infinity())
831
- {
832
- if (is_minus_infinity())
831
+ {
832
+ if (is_minus_infinity())
833
833
  return true;
834
834
  else
835
835
  return rhs.is_plus_infinity();
836
836
  }
837
837
  else
838
838
  return _fVal <= rhs._fVal;
839
- }
839
+ }
840
840
 
841
841
  bool geq(const BoundedDouble& rhs) const
842
842
  {
843
843
  if (is_infinity() ^ rhs.is_infinity())
844
- {
845
- if (is_infinity())
844
+ {
845
+ if (is_infinity())
846
846
  {
847
847
  return is_plus_infinity();
848
848
  }
@@ -852,15 +852,15 @@ public:
852
852
  }
853
853
  }
854
854
  if (is_infinity() && rhs.is_infinity())
855
- {
856
- if (is_plus_infinity())
855
+ {
856
+ if (is_plus_infinity())
857
857
  return true;
858
858
  else
859
859
  return rhs.is_minus_infinity();
860
860
  }
861
861
  else
862
862
  return _fVal >= rhs._fVal;
863
- }
863
+ }
864
864
 
865
865
  /// Reload operator
866
866
  //{%
@@ -1260,16 +1260,16 @@ public:
1260
1260
  inline s64_t getNumeral() const
1261
1261
  {
1262
1262
  if (is_minus_infinity())
1263
- {
1264
- return INT64_MIN;
1265
- }
1266
- else if (is_plus_infinity())
1267
- {
1268
- return INT64_MAX;
1269
- }
1270
- else
1271
- {
1272
- return std::round(_fVal);
1263
+ {
1264
+ return INT64_MIN;
1265
+ }
1266
+ else if (is_plus_infinity())
1267
+ {
1268
+ return INT64_MAX;
1269
+ }
1270
+ else
1271
+ {
1272
+ return std::round(_fVal);
1273
1273
  }
1274
1274
  }
1275
1275
 
@@ -217,12 +217,12 @@ public:
217
217
  IntervalValue getGepObjOffsetFromBase(const GepObjVar* obj) const
218
218
  {
219
219
  if (hasGepObjOffsetFromBase(obj))
220
- return gepObjOffsetFromBase.at(obj);
220
+ return gepObjOffsetFromBase.at(obj);
221
221
  else
222
222
  {
223
223
  assert(false && "GepObjVar not found in gepObjOffsetFromBase");
224
- abort();
225
- }
224
+ abort();
225
+ }
226
226
  }
227
227
 
228
228
  /**
@@ -274,8 +274,8 @@ public:
274
274
  void reportBug() override
275
275
  {
276
276
  if (!nodeToBugInfo.empty())
277
- {
278
- std::cerr << "######################Buffer Overflow (" + std::to_string(nodeToBugInfo.size())
277
+ {
278
+ std::cerr << "######################Buffer Overflow (" + std::to_string(nodeToBugInfo.size())
279
279
  + " found)######################\n";
280
280
  std::cerr << "---------------------------------------------\n";
281
281
  for (const auto& it : nodeToBugInfo)
@@ -405,8 +405,8 @@ public:
405
405
  void reportBug() override
406
406
  {
407
407
  if (!nodeToBugInfo.empty())
408
- {
409
- std::cerr << "###################### Nullptr Dereference (" + std::to_string(nodeToBugInfo.size())
408
+ {
409
+ std::cerr << "###################### Nullptr Dereference (" + std::to_string(nodeToBugInfo.size())
410
410
  + " found)######################\n";
411
411
  std::cerr << "---------------------------------------------\n";
412
412
  for (const auto& it : nodeToBugInfo)
@@ -163,9 +163,9 @@ public:
163
163
  {
164
164
  if (isTopLevelPtrStmt(dpm.getLoc())) return unionPts(dpm.getCurNodeID(), targetPts);
165
165
  else return dpmToADCPtSetMap[dpm] |= targetPts;
166
- }
166
+ }
167
167
 
168
- virtual const std::string PTAName() const override
168
+ virtual const std::string PTAName() const override
169
169
  {
170
170
  return "FlowSensitive DDA";
171
171
  }
@@ -193,12 +193,12 @@ public:
193
193
  inline CDGNode *getCDGNode(NodeID id) const
194
194
  {
195
195
  if (!hasCDGNode(id))
196
- return nullptr;
196
+ return nullptr;
197
197
  return getGNode(id);
198
198
  }
199
199
 
200
200
  /// Whether has the CDGNode
201
- inline bool hasCDGNode(NodeID id) const
201
+ inline bool hasCDGNode(NodeID id) const
202
202
  {
203
203
  return hasGNode(id);
204
204
  }
@@ -278,9 +278,9 @@ public:
278
278
  virtualFunctionToIDMap.find(vfn);
279
279
  if (it != virtualFunctionToIDMap.end())
280
280
  return it->second;
281
- else
282
- return -1;
283
- }
281
+ else
282
+ return -1;
283
+ }
284
284
  inline const FunObjVar* getVirtualFunctionBasedonID(u32_t id) const
285
285
  {
286
286
  Map<const FunObjVar*, u32_t>::const_iterator it, eit;
@@ -272,9 +272,9 @@ public:
272
272
 
273
273
  inline const SVFType* getSVFType(u32_t id) const
274
274
  {
275
- for(const SVFType* type : svfTypes)
276
- {
277
- if(type->getId() == id)
275
+ for(const SVFType* type : svfTypes)
276
+ {
277
+ if(type->getId() == id)
278
278
  return type;
279
279
  }
280
280
  return nullptr;
@@ -327,8 +327,8 @@ public:
327
327
  inline bool hasBlackHoleConstObjAddrAsDef(const ValVar* valVar) const
328
328
  {
329
329
  if (hasDef(valVar))
330
- {
331
- const VFGNode* defNode = getVFGNode(getDef(valVar));
330
+ {
331
+ const VFGNode* defNode = getVFGNode(getDef(valVar));
332
332
  if (const AddrVFGNode* addr = SVFUtil::dyn_cast<AddrVFGNode>(defNode))
333
333
  {
334
334
  if (SVFIR::getPAG()->isBlkObjOrConstantObj(addr->getSVFStmt()->getSrcID()))
@@ -506,13 +506,13 @@ protected:
506
506
  virtual inline bool isInterestedSVFVar(const SVFVar* node) const
507
507
  {
508
508
  if (isPtrOnlySVFG())
509
- return node->isPointer();
509
+ return node->isPointer();
510
510
  else
511
511
  return true;
512
- }
512
+ }
513
513
 
514
514
  /// Create edges between VFG nodes within a function
515
- void connectDirectVFGEdges();
515
+ void connectDirectVFGEdges();
516
516
 
517
517
  /// Create edges between VFG nodes across functions
518
518
  void addVFGInterEdges(const CallICFGNode* cs, const FunObjVar* callee);
@@ -712,7 +712,7 @@ protected:
712
712
  void visit(const WTONodeT& node) override
713
713
  {
714
714
  _nodeToWTOCycleDepth.insert(
715
- std::make_pair(node.getICFGNode(), _wtoCycleDepth));
715
+ std::make_pair(node.getICFGNode(), _wtoCycleDepth));
716
716
  }
717
717
 
718
718
  }; // end class WTOCycleDepthBuilder
@@ -321,30 +321,30 @@ public:
321
321
  inline bool hasOneCxtInLockSpan(const ICFGNode *I, LockSpan lspan) const
322
322
  {
323
323
  if(!hasCxtStmtFromInst(I))
324
- return false;
324
+ return false;
325
325
  const LockSpan ctsset = getCxtStmtsFromInst(I);
326
326
  for (LockSpan::const_iterator cts = ctsset.begin(), ects = ctsset.end(); cts != ects; cts++)
327
327
  {
328
328
  if(lspan.find(*cts) != lspan.end())
329
- {
330
- return true;
331
- }
329
+ {
330
+ return true;
332
331
  }
332
+ }
333
333
  return false;
334
334
  }
335
335
 
336
336
  inline bool hasAllCxtInLockSpan(const ICFGNode *I, LockSpan lspan) const
337
337
  {
338
338
  if(!hasCxtStmtFromInst(I))
339
- return false;
339
+ return false;
340
340
  const LockSpan ctsset = getCxtStmtsFromInst(I);
341
341
  for (LockSpan::const_iterator cts = ctsset.begin(), ects = ctsset.end(); cts != ects; cts++)
342
342
  {
343
343
  if (lspan.find(*cts) == lspan.end())
344
- {
345
- return false;
346
- }
344
+ {
345
+ return false;
347
346
  }
347
+ }
348
348
  return true;
349
349
  }
350
350