svf-tools 1.0.720 → 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.
|
|
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": {
|
|
@@ -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(
|
|
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());
|
|
@@ -1057,8 +1057,9 @@ StInfo* LLVMModuleSet::collectArrayInfo(const ArrayType* ty)
|
|
|
1057
1057
|
/// Array's flatten field infor is the same as its element's
|
|
1058
1058
|
/// flatten infor.
|
|
1059
1059
|
StInfo* elemStInfo = collectTypeInfo(elemTy);
|
|
1060
|
-
u32_t
|
|
1061
|
-
|
|
1060
|
+
u32_t nfF = elemStInfo->getNumOfFlattenFields();
|
|
1061
|
+
u32_t nfE = elemStInfo->getNumOfFlattenElements();
|
|
1062
|
+
for (u32_t j = 0; j < nfF; j++)
|
|
1062
1063
|
{
|
|
1063
1064
|
const SVFType* fieldTy = elemStInfo->getFlattenFieldTypes()[j];
|
|
1064
1065
|
stInfo->getFlattenFieldTypes().push_back(fieldTy);
|
|
@@ -1077,14 +1078,14 @@ StInfo* LLVMModuleSet::collectArrayInfo(const ArrayType* ty)
|
|
|
1077
1078
|
{
|
|
1078
1079
|
for (u32_t j = 0; j < nfE; ++j)
|
|
1079
1080
|
{
|
|
1080
|
-
const SVFType* et = elemStInfo->
|
|
1081
|
+
const SVFType* et = elemStInfo->getFlattenElementTypes()[j];
|
|
1081
1082
|
stInfo->getFlattenElementTypes().push_back(et);
|
|
1082
1083
|
}
|
|
1083
1084
|
}
|
|
1084
1085
|
|
|
1085
1086
|
assert(stInfo->getFlattenElementTypes().size() == nfE * totalElemNum &&
|
|
1086
1087
|
"typeForArray size incorrect!!!");
|
|
1087
|
-
stInfo->setNumOfFieldsAndElems(
|
|
1088
|
+
stInfo->setNumOfFieldsAndElems(nfF, nfE * totalElemNum);
|
|
1088
1089
|
|
|
1089
1090
|
return stInfo;
|
|
1090
1091
|
}
|
|
@@ -1112,23 +1113,22 @@ StInfo* LLVMModuleSet::collectStructInfo(const StructType* structTy,
|
|
|
1112
1113
|
if (SVFUtil::isa<StructType, ArrayType>(elemTy))
|
|
1113
1114
|
{
|
|
1114
1115
|
StInfo* subStInfo = collectTypeInfo(elemTy);
|
|
1115
|
-
u32_t
|
|
1116
|
+
u32_t nfF = subStInfo->getNumOfFlattenFields();
|
|
1117
|
+
u32_t nfE = subStInfo->getNumOfFlattenElements();
|
|
1116
1118
|
// Copy ST's info, whose element 0 is the size of ST itself.
|
|
1117
|
-
for (u32_t j = 0; j <
|
|
1119
|
+
for (u32_t j = 0; j < nfF; ++j)
|
|
1118
1120
|
{
|
|
1119
1121
|
const SVFType* elemTy = subStInfo->getFlattenFieldTypes()[j];
|
|
1120
1122
|
stInfo->getFlattenFieldTypes().push_back(elemTy);
|
|
1121
1123
|
}
|
|
1122
|
-
numFields +=
|
|
1123
|
-
strideOffset += nfE
|
|
1124
|
-
for (u32_t
|
|
1124
|
+
numFields += nfF;
|
|
1125
|
+
strideOffset += nfE;
|
|
1126
|
+
for (u32_t tpj = 0; tpj < nfE; ++tpj)
|
|
1125
1127
|
{
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
const SVFType* ty = subStInfo->getFlattenFieldTypes()[tpj];
|
|
1129
|
-
stInfo->getFlattenElementTypes().push_back(ty);
|
|
1130
|
-
}
|
|
1128
|
+
const SVFType* ty = subStInfo->getFlattenElementTypes()[tpj];
|
|
1129
|
+
stInfo->getFlattenElementTypes().push_back(ty);
|
|
1131
1130
|
}
|
|
1131
|
+
|
|
1132
1132
|
}
|
|
1133
1133
|
else
|
|
1134
1134
|
{
|