svf-tools 1.0.700 → 1.0.702

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.700",
3
+ "version": "1.0.702",
4
4
  "description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -299,7 +299,7 @@ public:
299
299
  }
300
300
  else
301
301
  {
302
- return this->_lb.leq(other._lb) && this->_ub.leq(other._ub);
302
+ return other._lb.leq(this->_lb) && this->_ub.leq(other._ub);
303
303
  }
304
304
 
305
305
  }
@@ -317,7 +317,7 @@ public:
317
317
  }
318
318
  else
319
319
  {
320
- return this->_lb.geq(other._lb) && this->_ub.geq(other._ub);
320
+ return other._lb.geq(this->_lb) && this->_ub.geq(other._ub);
321
321
  }
322
322
  }
323
323
 
@@ -381,7 +381,7 @@ public:
381
381
  }
382
382
  else
383
383
  {
384
- this->_lb = !lb().geq(other.lb()) ? minus_infinity() : this->lb();
384
+ this->_lb = !lb().leq(other.lb()) ? minus_infinity() : this->lb();
385
385
  this->_ub = !ub().geq(other.ub()) ? plus_infinity() : this->ub();
386
386
  }
387
387
  }
@@ -66,6 +66,10 @@ public:
66
66
  return _relEs;
67
67
  }
68
68
 
69
+ void widenVAddrs(IntervalExeState &lhs, const IntervalExeState &rhs);
70
+
71
+ void narrowVAddrs(IntervalExeState &lhs, const IntervalExeState &rhs);
72
+
69
73
  /// Return the field address given a pointer points to a struct object and an offset
70
74
  VAddrs getGepObjAddress(u32_t pointer, u32_t offset);
71
75
 
@@ -80,6 +80,78 @@ void SVFIR2ItvExeState::moveToGlobal()
80
80
  _es._locToVAddrs.clear();
81
81
  }
82
82
 
83
+ void SVFIR2ItvExeState::widenVAddrs(IntervalExeState &lhs, const IntervalExeState &rhs)
84
+ {
85
+ for (const auto &rhsItem: rhs._varToVAddrs)
86
+ {
87
+ auto lhsIter = lhs._varToVAddrs.find(rhsItem.first);
88
+ if (lhsIter != lhs._varToVAddrs.end())
89
+ {
90
+ for (const auto &addr: rhsItem.second)
91
+ {
92
+ if (!lhsIter->second.contains(addr))
93
+ {
94
+ for (s32_t i = 0; i < (s32_t) Options::MaxFieldLimit(); i++)
95
+ {
96
+ lhsIter->second.join_with(getGepObjAddress(getInternalID(addr), i));
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ for (const auto &rhsItem: rhs._locToVAddrs)
103
+ {
104
+ auto lhsIter = lhs._locToVAddrs.find(rhsItem.first);
105
+ if (lhsIter != lhs._locToVAddrs.end())
106
+ {
107
+ for (const auto &addr: rhsItem.second)
108
+ {
109
+ if (!lhsIter->second.contains(addr))
110
+ {
111
+ for (s32_t i = 0; i < (s32_t) Options::MaxFieldLimit(); i++)
112
+ {
113
+ lhsIter->second.join_with(getGepObjAddress(getInternalID(addr), i));
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ void SVFIR2ItvExeState::narrowVAddrs(IntervalExeState &lhs, const IntervalExeState &rhs)
122
+ {
123
+ for (const auto &rhsItem: rhs._varToVAddrs)
124
+ {
125
+ auto lhsIter = lhs._varToVAddrs.find(rhsItem.first);
126
+ if (lhsIter != lhs._varToVAddrs.end())
127
+ {
128
+ for (const auto &addr: lhsIter->second)
129
+ {
130
+ if (!rhsItem.second.contains(addr))
131
+ {
132
+ lhsIter->second = rhsItem.second;
133
+ break;
134
+ }
135
+ }
136
+ }
137
+ }
138
+ for (const auto &rhsItem: rhs._locToVAddrs)
139
+ {
140
+ auto lhsIter = lhs._locToVAddrs.find(rhsItem.first);
141
+ if (lhsIter != lhs._locToVAddrs.end())
142
+ {
143
+ for (const auto &addr: lhsIter->second)
144
+ {
145
+ if (!rhsItem.second.contains(addr))
146
+ {
147
+ lhsIter->second = rhsItem.second;
148
+ break;
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+
83
155
  SVFIR2ItvExeState::VAddrs SVFIR2ItvExeState::getGepObjAddress(u32_t pointer, u32_t offset)
84
156
  {
85
157
  assert(!getVAddrs(pointer).empty());
@@ -322,7 +322,7 @@ void SVFBugReport::dumpToJsonFile(const std::string& filePath)
322
322
 
323
323
  ofstream jsonFile(filePath, ios::out);
324
324
 
325
- jsonFile << "{";
325
+ jsonFile << "[";
326
326
 
327
327
  size_t commaCounter = bugSet.size() - 1; // comma num needed
328
328
  for(auto bugPtr : bugSet)
@@ -394,6 +394,6 @@ void SVFBugReport::dumpToJsonFile(const std::string& filePath)
394
394
  cJSON_Delete(singleBug);
395
395
  }
396
396
 
397
- jsonFile << "}";
397
+ jsonFile << "]";
398
398
  jsonFile.close();
399
- }
399
+ }