svf-tools 1.0.721 → 1.0.722

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.721",
3
+ "version": "1.0.722",
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": {
@@ -243,6 +243,11 @@ public:
243
243
  return saberCondAllocator.get();
244
244
  }
245
245
 
246
+ inline const SVFBugReport& getBugReport() const
247
+ {
248
+ return report;
249
+ }
250
+
246
251
  protected:
247
252
  /// Forward traverse
248
253
  inline void FWProcessCurNode(const DPIm& item) override
@@ -84,6 +84,7 @@ public:
84
84
 
85
85
  public:
86
86
  enum BugType {FULLBUFOVERFLOW, PARTIALBUFOVERFLOW, NEVERFREE, PARTIALLEAK, DOUBLEFREE, FILENEVERCLOSE, FILEPARTIALCLOSE};
87
+ static const std::map<GenericBug::BugType, std::string> BugType2Str;
87
88
 
88
89
  protected:
89
90
  BugType bugType;
@@ -355,7 +356,17 @@ public:
355
356
  * function: pass file path, open the file and dump bug report as JSON format
356
357
  * usage: dumpToFile("/path/to/file")
357
358
  */
358
- void dumpToJsonFile(const std::string& filePath);
359
+ void dumpToJsonFile(const std::string& filePath) const;
360
+
361
+ /*
362
+ * function: get underlying bugset
363
+ * usage: getBugSet()
364
+ */
365
+ const BugSet &getBugSet() const
366
+ {
367
+ return bugSet;
368
+ }
369
+
359
370
  };
360
371
  }
361
372
 
@@ -35,6 +35,17 @@
35
35
  using namespace std;
36
36
  using namespace SVF;
37
37
 
38
+ const std::map<GenericBug::BugType, std::string> GenericBug::BugType2Str =
39
+ {
40
+ {GenericBug::FULLBUFOVERFLOW, "Full Buffer Overflow"},
41
+ {GenericBug::PARTIALBUFOVERFLOW, "Partial Buffer Overflow"},
42
+ {GenericBug::NEVERFREE, "Never Free"},
43
+ {GenericBug::PARTIALLEAK, "Partial Leak"},
44
+ {GenericBug::FILENEVERCLOSE, "File Never Close"},
45
+ {GenericBug::FILEPARTIALCLOSE, "File Partial Close"},
46
+ {GenericBug::DOUBLEFREE, "Double Free"}
47
+ };
48
+
38
49
  const std::string GenericBug::getLoc() const
39
50
  {
40
51
  const SVFBugEvent&sourceInstEvent = bugEventStack.at(bugEventStack.size() -1);
@@ -299,7 +310,7 @@ SVFBugReport::~SVFBugReport()
299
310
  }
300
311
  }
301
312
 
302
- void SVFBugReport::dumpToJsonFile(const std::string& filePath)
313
+ void SVFBugReport::dumpToJsonFile(const std::string& filePath) const
303
314
  {
304
315
  std::map<u32_t, std::string> eventType2Str =
305
316
  {
@@ -309,17 +320,6 @@ void SVFBugReport::dumpToJsonFile(const std::string& filePath)
309
320
  {SVFBugEvent::Branch, "branch"}
310
321
  };
311
322
 
312
- std::map<GenericBug::BugType, std::string> bugType2Str =
313
- {
314
- {GenericBug::FULLBUFOVERFLOW, "Full Buffer Overflow"},
315
- {GenericBug::PARTIALBUFOVERFLOW, "Partial Buffer Overflow"},
316
- {GenericBug::NEVERFREE, "Never Free"},
317
- {GenericBug::PARTIALLEAK, "Partial Leak"},
318
- {GenericBug::FILENEVERCLOSE, "File Never Close"},
319
- {GenericBug::FILEPARTIALCLOSE, "File Partial Close"},
320
- {GenericBug::DOUBLEFREE, "Double Free"}
321
- };
322
-
323
323
  ofstream jsonFile(filePath, ios::out);
324
324
 
325
325
  jsonFile << "[";
@@ -330,7 +330,7 @@ void SVFBugReport::dumpToJsonFile(const std::string& filePath)
330
330
  cJSON *singleBug = cJSON_CreateObject();
331
331
 
332
332
  /// add bug information to json
333
- cJSON *bugType = cJSON_CreateString(bugType2Str[bugPtr->getBugType()].c_str());
333
+ cJSON *bugType = cJSON_CreateString(GenericBug::BugType2Str.at(bugPtr->getBugType()).c_str());
334
334
  cJSON_AddItemToObject(singleBug, "DefectType", bugType);
335
335
 
336
336
  cJSON *bugLoc = cJSON_Parse(bugPtr->getLoc().c_str());