svf-tools 1.0.715 → 1.0.717
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 +1 -1
- package/svf/include/Util/Annotator.h +1 -1
- package/svf/include/Util/SVFBugReport.h +4 -4
- package/svf/lib/SABER/DoubleFreeChecker.cpp +1 -1
- package/svf/lib/SABER/FileChecker.cpp +2 -2
- package/svf/lib/SABER/LeakChecker.cpp +2 -2
- package/svf/lib/SABER/ProgSlice.cpp +4 -4
- package/svf/lib/Util/SVFBugReport.cpp +17 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.717",
|
|
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": {
|
|
@@ -112,7 +112,7 @@ public:
|
|
|
112
112
|
values.push_back(val);
|
|
113
113
|
//llvm::ArrayRef<llvm::Metadata*> ar(metavalues);
|
|
114
114
|
// FIXME: delete the old MDNode
|
|
115
|
-
inst->setMetadata(str, MDNode::get(inst->getContext(),
|
|
115
|
+
inst->setMetadata(str, MDNode::get(inst->getContext(), nullptr));
|
|
116
116
|
//inst->setMetadata(str, llvm::MDNode::get(inst->getContext(), ar));
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -48,7 +48,7 @@ namespace SVF
|
|
|
48
48
|
*/
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
class
|
|
51
|
+
class SVFBugEvent
|
|
52
52
|
{
|
|
53
53
|
public:
|
|
54
54
|
enum EventType
|
|
@@ -65,8 +65,8 @@ protected:
|
|
|
65
65
|
const SVFInstruction *eventInst;
|
|
66
66
|
|
|
67
67
|
public:
|
|
68
|
-
|
|
69
|
-
virtual ~
|
|
68
|
+
SVFBugEvent(u32_t typeAndInfoFlag, const SVFInstruction *eventInst): typeAndInfoFlag(typeAndInfoFlag), eventInst(eventInst) { };
|
|
69
|
+
virtual ~SVFBugEvent() = default;
|
|
70
70
|
|
|
71
71
|
inline u32_t getEventType() const
|
|
72
72
|
{
|
|
@@ -80,7 +80,7 @@ public:
|
|
|
80
80
|
class GenericBug
|
|
81
81
|
{
|
|
82
82
|
public:
|
|
83
|
-
typedef std::vector<
|
|
83
|
+
typedef std::vector<SVFBugEvent> EventStack;
|
|
84
84
|
|
|
85
85
|
public:
|
|
86
86
|
enum BugType {FULLBUFOVERFLOW, PARTIALBUFOVERFLOW, NEVERFREE, PARTIALLEAK, DOUBLEFREE, FILENEVERCLOSE, FILEPARTIALCLOSE};
|
|
@@ -42,7 +42,7 @@ void DoubleFreeChecker::reportBug(ProgSlice* slice)
|
|
|
42
42
|
GenericBug::EventStack eventStack;
|
|
43
43
|
slice->evalFinalCond2Event(eventStack);
|
|
44
44
|
eventStack.push_back(
|
|
45
|
-
|
|
45
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())->getCallSite()));
|
|
46
46
|
report.addSaberBug(GenericBug::DOUBLEFREE, eventStack);
|
|
47
47
|
}
|
|
48
48
|
if(Options::ValidateTests())
|
|
@@ -41,7 +41,7 @@ void FileChecker::reportBug(ProgSlice* slice)
|
|
|
41
41
|
// full leakage
|
|
42
42
|
GenericBug::EventStack eventStack =
|
|
43
43
|
{
|
|
44
|
-
|
|
44
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())->getCallSite())
|
|
45
45
|
};
|
|
46
46
|
report.addSaberBug(GenericBug::FILENEVERCLOSE, eventStack);
|
|
47
47
|
}
|
|
@@ -50,7 +50,7 @@ void FileChecker::reportBug(ProgSlice* slice)
|
|
|
50
50
|
GenericBug::EventStack eventStack;
|
|
51
51
|
slice->evalFinalCond2Event(eventStack);
|
|
52
52
|
eventStack.push_back(
|
|
53
|
-
|
|
53
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())->getCallSite()));
|
|
54
54
|
report.addSaberBug(GenericBug::FILEPARTIALCLOSE, eventStack);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -154,7 +154,7 @@ void LeakChecker::reportBug(ProgSlice* slice)
|
|
|
154
154
|
// full leakage
|
|
155
155
|
GenericBug::EventStack eventStack =
|
|
156
156
|
{
|
|
157
|
-
|
|
157
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())->getCallSite())
|
|
158
158
|
};
|
|
159
159
|
report.addSaberBug(GenericBug::NEVERFREE, eventStack);
|
|
160
160
|
}
|
|
@@ -164,7 +164,7 @@ void LeakChecker::reportBug(ProgSlice* slice)
|
|
|
164
164
|
GenericBug::EventStack eventStack;
|
|
165
165
|
slice->evalFinalCond2Event(eventStack);
|
|
166
166
|
eventStack.push_back(
|
|
167
|
-
|
|
167
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())->getCallSite()));
|
|
168
168
|
report.addSaberBug(GenericBug::PARTIALLEAK, eventStack);
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -153,11 +153,11 @@ void ProgSlice::evalFinalCond2Event(GenericBug::EventStack &eventStack) const
|
|
|
153
153
|
{
|
|
154
154
|
const SVFInstruction* tinst = pathAllocator->getCondInst(*it);
|
|
155
155
|
if(pathAllocator->isNegCond(*it))
|
|
156
|
-
eventStack.push_back(
|
|
157
|
-
|
|
156
|
+
eventStack.push_back(SVFBugEvent(
|
|
157
|
+
SVFBugEvent::Branch|((((u32_t)false) << 4) & BRANCHFLAGMASK), tinst));
|
|
158
158
|
else
|
|
159
|
-
eventStack.push_back(
|
|
160
|
-
|
|
159
|
+
eventStack.push_back(SVFBugEvent(
|
|
160
|
+
SVFBugEvent::Branch|((((u32_t)true) << 4) & BRANCHFLAGMASK), tinst));
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -37,15 +37,15 @@ using namespace SVF;
|
|
|
37
37
|
|
|
38
38
|
const std::string GenericBug::getLoc() const
|
|
39
39
|
{
|
|
40
|
-
const
|
|
41
|
-
assert(sourceInstEvent.getEventType() ==
|
|
40
|
+
const SVFBugEvent&sourceInstEvent = bugEventStack.at(bugEventStack.size() -1);
|
|
41
|
+
assert(sourceInstEvent.getEventType() == SVFBugEvent::SourceInst && "bugEventStack top should be a SourceInst event");
|
|
42
42
|
return sourceInstEvent.getEventLoc();
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const std::string GenericBug::getFuncName() const
|
|
46
46
|
{
|
|
47
|
-
const
|
|
48
|
-
assert(sourceInstEvent.getEventType() ==
|
|
47
|
+
const SVFBugEvent&sourceInstEvent = bugEventStack.at(bugEventStack.size() -1);
|
|
48
|
+
assert(sourceInstEvent.getEventType() == SVFBugEvent::SourceInst && "bugEventStack top should be a SourceInst event");
|
|
49
49
|
return sourceInstEvent.getFuncName();
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -88,7 +88,7 @@ void BufferOverflowBug::printBugToTerminal() const
|
|
|
88
88
|
{
|
|
89
89
|
switch(event.getEventType())
|
|
90
90
|
{
|
|
91
|
-
case
|
|
91
|
+
case SVFBugEvent::CallSite:
|
|
92
92
|
{
|
|
93
93
|
SVFUtil::errs() << "\t\t callsite at : ( " << event.getEventLoc() << " )\n";
|
|
94
94
|
break;
|
|
@@ -239,21 +239,21 @@ void FilePartialCloseBug::printBugToTerminal() const
|
|
|
239
239
|
SVFUtil::errs() << "\n";
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
const std::string
|
|
242
|
+
const std::string SVFBugEvent::getFuncName() const
|
|
243
243
|
{
|
|
244
244
|
return eventInst->getFunction()->getName();
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
const std::string
|
|
247
|
+
const std::string SVFBugEvent::getEventLoc() const
|
|
248
248
|
{
|
|
249
249
|
return eventInst->getSourceLoc();
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
const std::string
|
|
252
|
+
const std::string SVFBugEvent::getEventDescription() const
|
|
253
253
|
{
|
|
254
254
|
switch(getEventType())
|
|
255
255
|
{
|
|
256
|
-
case
|
|
256
|
+
case SVFBugEvent::Branch:
|
|
257
257
|
{
|
|
258
258
|
if (typeAndInfoFlag & BRANCHFLAGMASK)
|
|
259
259
|
{
|
|
@@ -265,7 +265,7 @@ const std::string BugEvent::getEventDescription() const
|
|
|
265
265
|
}
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
268
|
-
case
|
|
268
|
+
case SVFBugEvent::CallSite:
|
|
269
269
|
{
|
|
270
270
|
std::string description("calls ");
|
|
271
271
|
const SVFFunction *callee = SVFUtil::getCallee(eventInst);
|
|
@@ -280,7 +280,7 @@ const std::string BugEvent::getEventDescription() const
|
|
|
280
280
|
return description;
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
283
|
-
case
|
|
283
|
+
case SVFBugEvent::SourceInst:
|
|
284
284
|
{
|
|
285
285
|
return "None";
|
|
286
286
|
}
|
|
@@ -303,10 +303,10 @@ void SVFBugReport::dumpToJsonFile(const std::string& filePath)
|
|
|
303
303
|
{
|
|
304
304
|
std::map<u32_t, std::string> eventType2Str =
|
|
305
305
|
{
|
|
306
|
-
{
|
|
307
|
-
{
|
|
308
|
-
{
|
|
309
|
-
{
|
|
306
|
+
{SVFBugEvent::CallSite, "call site"},
|
|
307
|
+
{SVFBugEvent::Caller, "caller"},
|
|
308
|
+
{SVFBugEvent::Loop, "loop"},
|
|
309
|
+
{SVFBugEvent::Branch, "branch"}
|
|
310
310
|
};
|
|
311
311
|
|
|
312
312
|
std::map<GenericBug::BugType, std::string> bugType2Str =
|
|
@@ -351,9 +351,9 @@ void SVFBugReport::dumpToJsonFile(const std::string& filePath)
|
|
|
351
351
|
if(BufferOverflowBug::classof(bugPtr))
|
|
352
352
|
{
|
|
353
353
|
// add only when bug is context sensitive
|
|
354
|
-
for(const
|
|
354
|
+
for(const SVFBugEvent&event : bugEventStack)
|
|
355
355
|
{
|
|
356
|
-
if (event.getEventType() ==
|
|
356
|
+
if (event.getEventType() == SVFBugEvent::SourceInst)
|
|
357
357
|
{
|
|
358
358
|
continue;
|
|
359
359
|
}
|