svf-tools 1.0.892 → 1.0.894
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/SVF-doxygen/html/AbstractExecution_8cpp.html +3 -3
- package/SVF-doxygen/html/AbstractExecution_8cpp_source.html +1746 -1753
- package/SVF-doxygen/html/AbstractExecution_8h.html +0 -2
- package/SVF-doxygen/html/AbstractExecution_8h_source.html +284 -335
- package/SVF-doxygen/html/BufOverflowChecker_8cpp_source.html +773 -791
- package/SVF-doxygen/html/BufOverflowChecker_8h.html +0 -2
- package/SVF-doxygen/html/BufOverflowChecker_8h_source.html +48 -81
- package/SVF-doxygen/html/ae_8cpp.html +16 -19
- package/SVF-doxygen/html/ae_8cpp_source.html +16 -19
- package/SVF-doxygen/html/annotated.html +434 -436
- package/SVF-doxygen/html/classSVF_1_1AEStat.html +168 -168
- package/SVF-doxygen/html/classSVF_1_1AbstractExecution-members.html +49 -24
- package/SVF-doxygen/html/classSVF_1_1AbstractExecution.html +2533 -1041
- package/SVF-doxygen/html/classSVF_1_1BufOverflowChecker-members.html +71 -41
- package/SVF-doxygen/html/classSVF_1_1BufOverflowChecker.html +777 -63
- package/SVF-doxygen/html/classes.html +418 -421
- package/SVF-doxygen/html/functions.html +8 -12
- package/SVF-doxygen/html/functions_a.html +10 -11
- package/SVF-doxygen/html/functions_b.html +5 -9
- package/SVF-doxygen/html/functions_c.html +26 -28
- package/SVF-doxygen/html/functions_d.html +2 -2
- package/SVF-doxygen/html/functions_e.html +2 -2
- package/SVF-doxygen/html/functions_enum.html +1 -1
- package/SVF-doxygen/html/functions_eval_m.html +2 -2
- package/SVF-doxygen/html/functions_eval_s.html +2 -2
- package/SVF-doxygen/html/functions_eval_u.html +1 -1
- package/SVF-doxygen/html/functions_func.html +9 -12
- package/SVF-doxygen/html/functions_func_b.html +2 -5
- package/SVF-doxygen/html/functions_func_c.html +25 -27
- package/SVF-doxygen/html/functions_func_d.html +2 -2
- package/SVF-doxygen/html/functions_func_g.html +15 -16
- package/SVF-doxygen/html/functions_func_h.html +6 -6
- package/SVF-doxygen/html/functions_func_i.html +9 -13
- package/SVF-doxygen/html/functions_func_p.html +1 -1
- package/SVF-doxygen/html/functions_func_s.html +19 -20
- package/SVF-doxygen/html/functions_func_t.html +1 -1
- package/SVF-doxygen/html/functions_func_~.html +0 -3
- package/SVF-doxygen/html/functions_g.html +21 -22
- package/SVF-doxygen/html/functions_h.html +6 -6
- package/SVF-doxygen/html/functions_i.html +15 -19
- package/SVF-doxygen/html/functions_l.html +5 -5
- package/SVF-doxygen/html/functions_m.html +2 -2
- package/SVF-doxygen/html/functions_o.html +15 -15
- package/SVF-doxygen/html/functions_p.html +13 -13
- package/SVF-doxygen/html/functions_r.html +4 -2
- package/SVF-doxygen/html/functions_s.html +21 -22
- package/SVF-doxygen/html/functions_t.html +5 -5
- package/SVF-doxygen/html/functions_type_c.html +1 -1
- package/SVF-doxygen/html/functions_u.html +1 -1
- package/SVF-doxygen/html/functions_vars.html +8 -12
- package/SVF-doxygen/html/functions_vars_b.html +0 -3
- package/SVF-doxygen/html/functions_w.html +7 -13
- package/SVF-doxygen/html/functions_~.html +0 -3
- package/SVF-doxygen/html/hierarchy.html +629 -631
- package/SVF-doxygen/html/namespaceSVF.html +5 -9
- package/SVF-doxygen/html/search/all_0.js +11 -11
- package/SVF-doxygen/html/search/all_1.js +5 -5
- package/SVF-doxygen/html/search/all_10.js +325 -325
- package/SVF-doxygen/html/search/all_11.js +226 -226
- package/SVF-doxygen/html/search/all_12.js +570 -570
- package/SVF-doxygen/html/search/all_13.js +207 -207
- package/SVF-doxygen/html/search/all_14.js +70 -70
- package/SVF-doxygen/html/search/all_15.js +176 -176
- package/SVF-doxygen/html/search/all_16.js +77 -77
- package/SVF-doxygen/html/search/all_17.js +1 -1
- package/SVF-doxygen/html/search/all_18.js +1 -1
- package/SVF-doxygen/html/search/all_19.js +26 -26
- package/SVF-doxygen/html/search/all_1a.js +179 -180
- package/SVF-doxygen/html/search/all_2.js +65 -66
- package/SVF-doxygen/html/search/all_3.js +640 -640
- package/SVF-doxygen/html/search/all_4.js +235 -235
- package/SVF-doxygen/html/search/all_5.js +126 -126
- package/SVF-doxygen/html/search/all_6.js +232 -232
- package/SVF-doxygen/html/search/all_7.js +1047 -1047
- package/SVF-doxygen/html/search/all_8.js +215 -215
- package/SVF-doxygen/html/search/all_9.js +629 -630
- package/SVF-doxygen/html/search/all_a.js +46 -46
- package/SVF-doxygen/html/search/all_b.js +26 -26
- package/SVF-doxygen/html/search/all_c.js +115 -115
- package/SVF-doxygen/html/search/all_d.js +204 -204
- package/SVF-doxygen/html/search/all_e.js +209 -209
- package/SVF-doxygen/html/search/all_f.js +122 -122
- package/SVF-doxygen/html/search/classes_0.js +28 -29
- package/SVF-doxygen/html/search/classes_1.js +11 -12
- package/SVF-doxygen/html/search/classes_10.js +74 -74
- package/SVF-doxygen/html/search/classes_11.js +14 -14
- package/SVF-doxygen/html/search/classes_12.js +2 -2
- package/SVF-doxygen/html/search/classes_13.js +10 -10
- package/SVF-doxygen/html/search/classes_14.js +19 -19
- package/SVF-doxygen/html/search/classes_15.js +1 -1
- package/SVF-doxygen/html/search/classes_2.js +73 -73
- package/SVF-doxygen/html/search/classes_3.js +35 -35
- package/SVF-doxygen/html/search/classes_4.js +8 -8
- package/SVF-doxygen/html/search/classes_5.js +28 -28
- package/SVF-doxygen/html/search/classes_6.js +98 -98
- package/SVF-doxygen/html/search/classes_7.js +38 -38
- package/SVF-doxygen/html/search/classes_8.js +59 -59
- package/SVF-doxygen/html/search/classes_9.js +1 -1
- package/SVF-doxygen/html/search/classes_a.js +12 -12
- package/SVF-doxygen/html/search/classes_b.js +29 -29
- package/SVF-doxygen/html/search/classes_c.js +6 -6
- package/SVF-doxygen/html/search/classes_d.js +19 -19
- package/SVF-doxygen/html/search/classes_e.js +36 -36
- package/SVF-doxygen/html/search/classes_f.js +25 -25
- package/SVF-doxygen/html/search/defines_0.js +3 -3
- package/SVF-doxygen/html/search/defines_1.js +3 -3
- package/SVF-doxygen/html/search/defines_10.js +2 -2
- package/SVF-doxygen/html/search/defines_2.js +30 -30
- package/SVF-doxygen/html/search/defines_3.js +20 -20
- package/SVF-doxygen/html/search/defines_4.js +3 -3
- package/SVF-doxygen/html/search/defines_5.js +4 -4
- package/SVF-doxygen/html/search/defines_6.js +2 -2
- package/SVF-doxygen/html/search/defines_7.js +5 -5
- package/SVF-doxygen/html/search/defines_8.js +11 -11
- package/SVF-doxygen/html/search/defines_9.js +9 -9
- package/SVF-doxygen/html/search/defines_a.js +2 -2
- package/SVF-doxygen/html/search/defines_b.js +1 -1
- package/SVF-doxygen/html/search/defines_c.js +4 -4
- package/SVF-doxygen/html/search/defines_d.js +2 -2
- package/SVF-doxygen/html/search/defines_e.js +8 -8
- package/SVF-doxygen/html/search/defines_f.js +4 -4
- package/SVF-doxygen/html/search/enums_0.js +4 -4
- package/SVF-doxygen/html/search/enums_1.js +2 -2
- package/SVF-doxygen/html/search/enums_10.js +1 -1
- package/SVF-doxygen/html/search/enums_11.js +1 -1
- package/SVF-doxygen/html/search/enums_2.js +8 -8
- package/SVF-doxygen/html/search/enums_3.js +1 -1
- package/SVF-doxygen/html/search/enums_4.js +4 -4
- package/SVF-doxygen/html/search/enums_5.js +1 -1
- package/SVF-doxygen/html/search/enums_6.js +2 -2
- package/SVF-doxygen/html/search/enums_7.js +2 -2
- package/SVF-doxygen/html/search/enums_8.js +4 -4
- package/SVF-doxygen/html/search/enums_9.js +1 -1
- package/SVF-doxygen/html/search/enums_a.js +1 -1
- package/SVF-doxygen/html/search/enums_b.js +7 -7
- package/SVF-doxygen/html/search/enums_c.js +1 -1
- package/SVF-doxygen/html/search/enums_d.js +4 -4
- package/SVF-doxygen/html/search/enums_e.js +2 -2
- package/SVF-doxygen/html/search/enums_f.js +4 -4
- package/SVF-doxygen/html/search/enumvalues_0.js +15 -15
- package/SVF-doxygen/html/search/enumvalues_1.js +15 -15
- package/SVF-doxygen/html/search/enumvalues_10.js +35 -35
- package/SVF-doxygen/html/search/enumvalues_11.js +4 -4
- package/SVF-doxygen/html/search/enumvalues_12.js +10 -10
- package/SVF-doxygen/html/search/enumvalues_13.js +1 -1
- package/SVF-doxygen/html/search/enumvalues_14.js +1 -1
- package/SVF-doxygen/html/search/enumvalues_15.js +3 -3
- package/SVF-doxygen/html/search/enumvalues_2.js +36 -36
- package/SVF-doxygen/html/search/enumvalues_3.js +13 -13
- package/SVF-doxygen/html/search/enumvalues_4.js +2 -2
- package/SVF-doxygen/html/search/enumvalues_5.js +47 -47
- package/SVF-doxygen/html/search/enumvalues_6.js +6 -6
- package/SVF-doxygen/html/search/enumvalues_7.js +8 -8
- package/SVF-doxygen/html/search/enumvalues_8.js +23 -23
- package/SVF-doxygen/html/search/enumvalues_9.js +6 -6
- package/SVF-doxygen/html/search/enumvalues_a.js +17 -17
- package/SVF-doxygen/html/search/enumvalues_b.js +11 -11
- package/SVF-doxygen/html/search/enumvalues_c.js +5 -5
- package/SVF-doxygen/html/search/enumvalues_d.js +18 -18
- package/SVF-doxygen/html/search/enumvalues_e.js +9 -9
- package/SVF-doxygen/html/search/enumvalues_f.js +47 -47
- package/SVF-doxygen/html/search/files_0.js +16 -16
- package/SVF-doxygen/html/search/files_1.js +9 -9
- package/SVF-doxygen/html/search/files_10.js +8 -8
- package/SVF-doxygen/html/search/files_11.js +8 -8
- package/SVF-doxygen/html/search/files_12.js +2 -2
- package/SVF-doxygen/html/search/files_2.js +53 -53
- package/SVF-doxygen/html/search/files_3.js +14 -14
- package/SVF-doxygen/html/search/files_4.js +5 -5
- package/SVF-doxygen/html/search/files_5.js +13 -13
- package/SVF-doxygen/html/search/files_6.js +10 -10
- package/SVF-doxygen/html/search/files_7.js +17 -17
- package/SVF-doxygen/html/search/files_8.js +13 -13
- package/SVF-doxygen/html/search/files_9.js +18 -18
- package/SVF-doxygen/html/search/files_a.js +3 -3
- package/SVF-doxygen/html/search/files_b.js +4 -4
- package/SVF-doxygen/html/search/files_c.js +20 -20
- package/SVF-doxygen/html/search/files_d.js +4 -4
- package/SVF-doxygen/html/search/files_e.js +62 -62
- package/SVF-doxygen/html/search/files_f.js +8 -8
- package/SVF-doxygen/html/search/functions_0.js +13 -13
- package/SVF-doxygen/html/search/functions_1.js +368 -369
- package/SVF-doxygen/html/search/functions_10.js +140 -140
- package/SVF-doxygen/html/search/functions_11.js +140 -140
- package/SVF-doxygen/html/search/functions_12.js +299 -299
- package/SVF-doxygen/html/search/functions_13.js +73 -73
- package/SVF-doxygen/html/search/functions_14.js +41 -41
- package/SVF-doxygen/html/search/functions_15.js +72 -72
- package/SVF-doxygen/html/search/functions_16.js +38 -38
- package/SVF-doxygen/html/search/functions_17.js +3 -3
- package/SVF-doxygen/html/search/functions_18.js +179 -180
- package/SVF-doxygen/html/search/functions_2.js +94 -95
- package/SVF-doxygen/html/search/functions_3.js +261 -261
- package/SVF-doxygen/html/search/functions_4.js +84 -84
- package/SVF-doxygen/html/search/functions_5.js +57 -57
- package/SVF-doxygen/html/search/functions_6.js +65 -65
- package/SVF-doxygen/html/search/functions_7.js +863 -863
- package/SVF-doxygen/html/search/functions_8.js +162 -162
- package/SVF-doxygen/html/search/functions_9.js +438 -439
- package/SVF-doxygen/html/search/functions_a.js +30 -30
- package/SVF-doxygen/html/search/functions_b.js +2 -2
- package/SVF-doxygen/html/search/functions_c.js +25 -25
- package/SVF-doxygen/html/search/functions_d.js +82 -82
- package/SVF-doxygen/html/search/functions_e.js +36 -36
- package/SVF-doxygen/html/search/functions_f.js +58 -58
- package/SVF-doxygen/html/search/namespaces_0.js +1 -1
- package/SVF-doxygen/html/search/namespaces_1.js +7 -7
- package/SVF-doxygen/html/search/related_0.js +4 -4
- package/SVF-doxygen/html/search/related_1.js +2 -2
- package/SVF-doxygen/html/search/related_2.js +2 -2
- package/SVF-doxygen/html/search/related_3.js +2 -2
- package/SVF-doxygen/html/search/related_4.js +2 -2
- package/SVF-doxygen/html/search/related_5.js +1 -1
- package/SVF-doxygen/html/search/related_6.js +2 -2
- package/SVF-doxygen/html/search/related_7.js +5 -5
- package/SVF-doxygen/html/search/related_8.js +2 -2
- package/SVF-doxygen/html/search/related_9.js +4 -4
- package/SVF-doxygen/html/search/related_a.js +19 -19
- package/SVF-doxygen/html/search/related_b.js +4 -4
- package/SVF-doxygen/html/search/related_c.js +2 -2
- package/SVF-doxygen/html/search/related_d.js +12 -12
- package/SVF-doxygen/html/search/related_e.js +2 -2
- package/SVF-doxygen/html/search/related_f.js +2 -2
- package/SVF-doxygen/html/search/typedefs_0.js +19 -19
- package/SVF-doxygen/html/search/typedefs_1.js +27 -27
- package/SVF-doxygen/html/search/typedefs_10.js +63 -63
- package/SVF-doxygen/html/search/typedefs_11.js +13 -13
- package/SVF-doxygen/html/search/typedefs_12.js +11 -11
- package/SVF-doxygen/html/search/typedefs_13.js +40 -40
- package/SVF-doxygen/html/search/typedefs_14.js +11 -11
- package/SVF-doxygen/html/search/typedefs_2.js +125 -125
- package/SVF-doxygen/html/search/typedefs_3.js +39 -39
- package/SVF-doxygen/html/search/typedefs_4.js +17 -17
- package/SVF-doxygen/html/search/typedefs_5.js +42 -42
- package/SVF-doxygen/html/search/typedefs_6.js +54 -54
- package/SVF-doxygen/html/search/typedefs_7.js +47 -47
- package/SVF-doxygen/html/search/typedefs_8.js +1 -1
- package/SVF-doxygen/html/search/typedefs_9.js +6 -6
- package/SVF-doxygen/html/search/typedefs_a.js +29 -29
- package/SVF-doxygen/html/search/typedefs_b.js +29 -29
- package/SVF-doxygen/html/search/typedefs_c.js +41 -41
- package/SVF-doxygen/html/search/typedefs_d.js +15 -15
- package/SVF-doxygen/html/search/typedefs_e.js +52 -52
- package/SVF-doxygen/html/search/typedefs_f.js +14 -14
- package/SVF-doxygen/html/search/variables_0.js +177 -177
- package/SVF-doxygen/html/search/variables_1.js +76 -76
- package/SVF-doxygen/html/search/variables_10.js +98 -98
- package/SVF-doxygen/html/search/variables_11.js +46 -46
- package/SVF-doxygen/html/search/variables_12.js +93 -93
- package/SVF-doxygen/html/search/variables_13.js +76 -76
- package/SVF-doxygen/html/search/variables_14.js +14 -14
- package/SVF-doxygen/html/search/variables_15.js +49 -49
- package/SVF-doxygen/html/search/variables_16.js +11 -11
- package/SVF-doxygen/html/search/variables_17.js +1 -1
- package/SVF-doxygen/html/search/variables_18.js +17 -17
- package/SVF-doxygen/html/search/variables_2.js +40 -41
- package/SVF-doxygen/html/search/variables_3.js +142 -142
- package/SVF-doxygen/html/search/variables_4.js +51 -51
- package/SVF-doxygen/html/search/variables_5.js +39 -39
- package/SVF-doxygen/html/search/variables_6.js +66 -66
- package/SVF-doxygen/html/search/variables_7.js +34 -34
- package/SVF-doxygen/html/search/variables_8.js +8 -8
- package/SVF-doxygen/html/search/variables_9.js +79 -79
- package/SVF-doxygen/html/search/variables_a.js +4 -4
- package/SVF-doxygen/html/search/variables_b.js +10 -10
- package/SVF-doxygen/html/search/variables_c.js +45 -45
- package/SVF-doxygen/html/search/variables_d.js +57 -57
- package/SVF-doxygen/html/search/variables_e.js +123 -123
- package/SVF-doxygen/html/search/variables_f.js +31 -31
- package/package.json +1 -1
- package/setup.sh +1 -1
- package/svf/include/AE/Svfexe/AbstractExecution.h +55 -102
- package/svf/include/AE/Svfexe/BufOverflowChecker.h +12 -33
- package/svf/lib/AE/Svfexe/AbstractExecution.cpp +59 -64
- package/svf/lib/AE/Svfexe/BufOverflowChecker.cpp +44 -59
- package/svf-llvm/tools/AE/ae.cpp +1 -2
|
@@ -68,13 +68,12 @@ void BufOverflowChecker::handleSVFStatement(const SVFStmt *stmt)
|
|
|
68
68
|
for (NodeID addrID: _svfir2ExeState->getAddrs(gep->getLHSVarID()))
|
|
69
69
|
{
|
|
70
70
|
NodeID objId = _svfir2ExeState->getInternalID(addrID);
|
|
71
|
-
|
|
72
|
-
extapi->_addrToGep[objId] = gep;
|
|
71
|
+
_addrToGep[objId] = gep;
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
void
|
|
76
|
+
void BufOverflowChecker::initExtAPIBufOverflowCheckRules()
|
|
78
77
|
{
|
|
79
78
|
//void llvm_memcpy_p0i8_p0i8_i64(char* dst, char* src, int sz, int flag){}
|
|
80
79
|
_extAPIBufOverflowCheckRules["llvm_memcpy_p0i8_p0i8_i64"] = {{0, 2}, {1,2}};
|
|
@@ -121,7 +120,7 @@ void BufOverflowCheckerAPI::initExtAPIBufOverflowCheckRules()
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
|
|
124
|
-
bool
|
|
123
|
+
bool BufOverflowChecker::detectStrcpy(const CallICFGNode *call)
|
|
125
124
|
{
|
|
126
125
|
CallSite cs = SVFUtil::getSVFCallSite(call->getCallSite());
|
|
127
126
|
const SVFValue* arg0Val = cs.getArgument(0);
|
|
@@ -131,29 +130,28 @@ bool BufOverflowCheckerAPI::detectStrcpy(const CallICFGNode *call)
|
|
|
131
130
|
return canSafelyAccessMemory(arg0Val, strLen, call);
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
void
|
|
133
|
+
void BufOverflowChecker::initExtFunMap()
|
|
135
134
|
{
|
|
136
135
|
|
|
137
136
|
auto sse_scanf = [&](const CallSite &cs)
|
|
138
137
|
{
|
|
139
138
|
//scanf("%d", &data);
|
|
140
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
141
139
|
if (cs.arg_size() < 2) return;
|
|
142
|
-
IntervalExeState &es =
|
|
140
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
143
141
|
u32_t dst_id = _svfir->getValueNode(cs.getArgument(1));
|
|
144
|
-
if (!
|
|
142
|
+
if (!_svfir2ExeState->inVarToAddrsTable(dst_id))
|
|
145
143
|
{
|
|
146
144
|
BufOverflowException bug("scanf may cause buffer overflow.\n", 0, 0, 0, 0, cs.getArgument(1));
|
|
147
|
-
|
|
145
|
+
addBugToRecoder(bug, _svfir->getICFG()->getICFGNode(cs.getInstruction()));
|
|
148
146
|
return;
|
|
149
147
|
}
|
|
150
148
|
else
|
|
151
149
|
{
|
|
152
|
-
ExeState::Addrs Addrs =
|
|
150
|
+
ExeState::Addrs Addrs = _svfir2ExeState->getAddrs(dst_id);
|
|
153
151
|
for (auto vaddr: Addrs)
|
|
154
152
|
{
|
|
155
|
-
u32_t objId =
|
|
156
|
-
IntervalValue range =
|
|
153
|
+
u32_t objId = _svfir2ExeState->getInternalID(vaddr);
|
|
154
|
+
IntervalValue range = _svfir2ExeState->getRangeLimitFromType(_svfir->getGNode(objId)->getType());
|
|
157
155
|
es.store(vaddr, range);
|
|
158
156
|
}
|
|
159
157
|
}
|
|
@@ -161,23 +159,22 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
161
159
|
auto sse_fscanf = [&](const CallSite &cs)
|
|
162
160
|
{
|
|
163
161
|
//fscanf(stdin, "%d", &data);
|
|
164
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
165
162
|
if (cs.arg_size() < 3) return;
|
|
166
|
-
IntervalExeState &es =
|
|
163
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
167
164
|
u32_t dst_id = _svfir->getValueNode(cs.getArgument(2));
|
|
168
|
-
if (!
|
|
165
|
+
if (!_svfir2ExeState->inVarToAddrsTable(dst_id))
|
|
169
166
|
{
|
|
170
167
|
BufOverflowException bug("scanf may cause buffer overflow.\n", 0, 0, 0, 0, cs.getArgument(2));
|
|
171
|
-
|
|
168
|
+
addBugToRecoder(bug, _svfir->getICFG()->getICFGNode(cs.getInstruction()));
|
|
172
169
|
return;
|
|
173
170
|
}
|
|
174
171
|
else
|
|
175
172
|
{
|
|
176
|
-
ExeState::Addrs Addrs =
|
|
173
|
+
ExeState::Addrs Addrs = _svfir2ExeState->getAddrs(dst_id);
|
|
177
174
|
for (auto vaddr: Addrs)
|
|
178
175
|
{
|
|
179
|
-
u32_t objId =
|
|
180
|
-
IntervalValue range =
|
|
176
|
+
u32_t objId = _svfir2ExeState->getInternalID(vaddr);
|
|
177
|
+
IntervalValue range = _svfir2ExeState->getRangeLimitFromType(_svfir->getGNode(objId)->getType());
|
|
181
178
|
es.store(vaddr, range);
|
|
182
179
|
}
|
|
183
180
|
}
|
|
@@ -194,9 +191,8 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
194
191
|
|
|
195
192
|
auto sse_fread = [&](const CallSite &cs)
|
|
196
193
|
{
|
|
197
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
198
194
|
if (cs.arg_size() < 3) return;
|
|
199
|
-
IntervalExeState &es =
|
|
195
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
200
196
|
u32_t block_count_id = _svfir->getValueNode(cs.getArgument(2));
|
|
201
197
|
u32_t block_size_id = _svfir->getValueNode(cs.getArgument(1));
|
|
202
198
|
IntervalValue block_count = es[block_count_id];
|
|
@@ -213,9 +209,8 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
213
209
|
|
|
214
210
|
auto sse_snprintf = [&](const CallSite &cs)
|
|
215
211
|
{
|
|
216
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
217
212
|
if (cs.arg_size() < 2) return;
|
|
218
|
-
IntervalExeState &es =
|
|
213
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
219
214
|
u32_t size_id = _svfir->getValueNode(cs.getArgument(1));
|
|
220
215
|
u32_t dst_id = _svfir->getValueNode(cs.getArgument(0));
|
|
221
216
|
// get elem size of arg2
|
|
@@ -241,7 +236,7 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
241
236
|
BufOverflowException bug(
|
|
242
237
|
"snprintf dst_id or dst is not defined nor initializesd.\n",
|
|
243
238
|
0, 0, 0, 0, cs.getArgument(0));
|
|
244
|
-
|
|
239
|
+
addBugToRecoder(bug, _svfir->getICFG()->getICFGNode(cs.getInstruction()));
|
|
245
240
|
return;
|
|
246
241
|
}
|
|
247
242
|
}
|
|
@@ -263,9 +258,8 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
263
258
|
{
|
|
264
259
|
// itoa(num, ch, 10);
|
|
265
260
|
// num: int, ch: char*, 10 is decimal
|
|
266
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
267
261
|
if (cs.arg_size() < 3) return;
|
|
268
|
-
IntervalExeState &es =
|
|
262
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
269
263
|
u32_t num_id = _svfir->getValueNode(cs.getArgument(0));
|
|
270
264
|
|
|
271
265
|
u32_t num = (u32_t) es[num_id].getNumeral();
|
|
@@ -278,10 +272,9 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
278
272
|
auto sse_strlen = [&](const CallSite &cs)
|
|
279
273
|
{
|
|
280
274
|
// check the arg size
|
|
281
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
282
275
|
if (cs.arg_size() < 1) return;
|
|
283
276
|
const SVFValue* strValue = cs.getArgument(0);
|
|
284
|
-
IntervalExeState &es =
|
|
277
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
285
278
|
IntervalValue dst_size = getStrlen(strValue);
|
|
286
279
|
u32_t elemSize = 1;
|
|
287
280
|
if (strValue->getType()->isArrayTy())
|
|
@@ -301,9 +294,8 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
301
294
|
auto sse_recv = [&](const CallSite &cs)
|
|
302
295
|
{
|
|
303
296
|
// recv(sockfd, buf, len, flags);
|
|
304
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
305
297
|
if (cs.arg_size() < 4) return;
|
|
306
|
-
IntervalExeState &es =
|
|
298
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
307
299
|
u32_t len_id = _svfir->getValueNode(cs.getArgument(2));
|
|
308
300
|
IntervalValue len = es[len_id] - IntervalValue(1);
|
|
309
301
|
u32_t lhsId = _svfir->getValueNode(cs.getInstruction());
|
|
@@ -317,9 +309,8 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
317
309
|
const CallICFGNode* callNode = SVFUtil::dyn_cast<CallICFGNode>(_svfir->getICFG()->getICFGNode(cs.getInstruction()));
|
|
318
310
|
_checkpoints.erase(callNode);
|
|
319
311
|
//void SAFE_BUFACCESS(void* data, int size);
|
|
320
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
321
312
|
if (cs.arg_size() < 2) return;
|
|
322
|
-
IntervalExeState &es =
|
|
313
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
323
314
|
u32_t size_id = _svfir->getValueNode(cs.getArgument(1));
|
|
324
315
|
IntervalValue val = es[size_id];
|
|
325
316
|
if (val.isBottom())
|
|
@@ -348,9 +339,8 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
348
339
|
const CallICFGNode* callNode = SVFUtil::dyn_cast<CallICFGNode>(_svfir->getICFG()->getICFGNode(cs.getInstruction()));
|
|
349
340
|
_checkpoints.erase(callNode);
|
|
350
341
|
//void UNSAFE_BUFACCESS(void* data, int size);
|
|
351
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
352
342
|
if (cs.arg_size() < 2) return;
|
|
353
|
-
IntervalExeState &es =
|
|
343
|
+
IntervalExeState &es = _svfir2ExeState->getEs();
|
|
354
344
|
u32_t size_id = _svfir->getValueNode(cs.getArgument(1));
|
|
355
345
|
IntervalValue val = es[size_id];
|
|
356
346
|
if (val.isBottom())
|
|
@@ -379,9 +369,8 @@ void BufOverflowCheckerAPI::initExtFunMap()
|
|
|
379
369
|
_checkpoint_names.insert("UNSAFE_BUFACCESS");
|
|
380
370
|
}
|
|
381
371
|
|
|
382
|
-
bool
|
|
372
|
+
bool BufOverflowChecker::detectStrcat(const CallICFGNode *call)
|
|
383
373
|
{
|
|
384
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
385
374
|
const SVFFunction *fun = SVFUtil::getCallee(call->getCallSite());
|
|
386
375
|
// check the arg size
|
|
387
376
|
// if it is strcat group, we need to check the length of string,
|
|
@@ -406,7 +395,7 @@ bool BufOverflowCheckerAPI::detectStrcat(const CallICFGNode *call)
|
|
|
406
395
|
CallSite cs = SVFUtil::getSVFCallSite(call->getCallSite());
|
|
407
396
|
const SVFValue* arg0Val = cs.getArgument(0);
|
|
408
397
|
const SVFValue* arg2Val = cs.getArgument(2);
|
|
409
|
-
IntervalValue arg2Num =
|
|
398
|
+
IntervalValue arg2Num = _svfir2ExeState->getEs()[_svfir->getValueNode(arg2Val)];
|
|
410
399
|
IntervalValue strLen0 = getStrlen(arg0Val);
|
|
411
400
|
IntervalValue totalLen = strLen0 + arg2Num;
|
|
412
401
|
return canSafelyAccessMemory(arg0Val, totalLen, call);
|
|
@@ -418,10 +407,9 @@ bool BufOverflowCheckerAPI::detectStrcat(const CallICFGNode *call)
|
|
|
418
407
|
}
|
|
419
408
|
}
|
|
420
409
|
|
|
421
|
-
void
|
|
410
|
+
void BufOverflowChecker::handleExtAPI(const CallICFGNode *call)
|
|
422
411
|
{
|
|
423
|
-
|
|
424
|
-
BufOverflowChecker* ae = SVFUtil::dyn_cast<BufOverflowChecker>(_ae);
|
|
412
|
+
AbstractExecution::handleExtAPI(call);
|
|
425
413
|
const SVFFunction *fun = SVFUtil::getCallee(call->getCallSite());
|
|
426
414
|
assert(fun && "SVFFunction* is nullptr");
|
|
427
415
|
CallSite cs = SVFUtil::getSVFCallSite(call->getCallSite());
|
|
@@ -458,7 +446,7 @@ void BufOverflowCheckerAPI::handleExtAPI(const CallICFGNode *call)
|
|
|
458
446
|
// loop the args and check the offset
|
|
459
447
|
for (auto arg: args)
|
|
460
448
|
{
|
|
461
|
-
IntervalValue offset =
|
|
449
|
+
IntervalValue offset = _svfir2ExeState->getEs()[_svfir->getValueNode(cs.getArgument(arg.second))] - IntervalValue(1);
|
|
462
450
|
canSafelyAccessMemory(cs.getArgument(arg.first), offset, call);
|
|
463
451
|
}
|
|
464
452
|
}
|
|
@@ -475,7 +463,7 @@ void BufOverflowCheckerAPI::handleExtAPI(const CallICFGNode *call)
|
|
|
475
463
|
// loop the args and check the offset
|
|
476
464
|
for (auto arg: args)
|
|
477
465
|
{
|
|
478
|
-
IntervalValue offset =
|
|
466
|
+
IntervalValue offset = _svfir2ExeState->getEs()[_svfir->getValueNode(cs.getArgument(arg.second))] - IntervalValue(1);
|
|
479
467
|
canSafelyAccessMemory(cs.getArgument(arg.first), offset, call);
|
|
480
468
|
}
|
|
481
469
|
}
|
|
@@ -494,9 +482,8 @@ void BufOverflowCheckerAPI::handleExtAPI(const CallICFGNode *call)
|
|
|
494
482
|
return;
|
|
495
483
|
}
|
|
496
484
|
|
|
497
|
-
bool
|
|
485
|
+
bool BufOverflowChecker::canSafelyAccessMemory(const SVFValue *value, const IntervalValue &len, const ICFGNode *curNode)
|
|
498
486
|
{
|
|
499
|
-
BufOverflowChecker* ae = static_cast<BufOverflowChecker*>(this->_ae);
|
|
500
487
|
const SVFValue *firstValue = value;
|
|
501
488
|
/// Usually called by a GepStmt overflow check, or external API (like memcpy) overflow check
|
|
502
489
|
/// Defitions of Terms:
|
|
@@ -512,7 +499,7 @@ bool BufOverflowCheckerAPI::canSafelyAccessMemory(const SVFValue *value, const I
|
|
|
512
499
|
Map<const ICFGNode *, IntervalValue> gep_offsets;
|
|
513
500
|
IntervalValue total_bytes = len;
|
|
514
501
|
worklist.push(value);
|
|
515
|
-
std::vector<const CallICFGNode *> callstack =
|
|
502
|
+
std::vector<const CallICFGNode *> callstack = _callSiteStack;
|
|
516
503
|
while (!worklist.empty())
|
|
517
504
|
{
|
|
518
505
|
value = worklist.pop();
|
|
@@ -564,7 +551,7 @@ bool BufOverflowCheckerAPI::canSafelyAccessMemory(const SVFValue *value, const I
|
|
|
564
551
|
}
|
|
565
552
|
else
|
|
566
553
|
{
|
|
567
|
-
byteOffset =
|
|
554
|
+
byteOffset = _svfir2ExeState->getByteOffset(gep);
|
|
568
555
|
}
|
|
569
556
|
// for variable offset, join with accumulate gep offset
|
|
570
557
|
gep_offsets[gep->getICFGNode()] = byteOffset;
|
|
@@ -593,7 +580,7 @@ bool BufOverflowCheckerAPI::canSafelyAccessMemory(const SVFValue *value, const I
|
|
|
593
580
|
else
|
|
594
581
|
{
|
|
595
582
|
u32_t idx = _svfir->getValueNode(idxValue);
|
|
596
|
-
IntervalValue idxVal =
|
|
583
|
+
IntervalValue idxVal = _svfir2ExeState->getEs()[idx];
|
|
597
584
|
if (idxVal.isBottom())
|
|
598
585
|
{
|
|
599
586
|
gepArrTotalByte = gepArrTotalByte + IntervalValue(0, 0);
|
|
@@ -632,7 +619,7 @@ bool BufOverflowCheckerAPI::canSafelyAccessMemory(const SVFValue *value, const I
|
|
|
632
619
|
gepArrType->getByteSize(),
|
|
633
620
|
total_bytes.lb().getNumeral(), total_bytes.ub().getNumeral(),
|
|
634
621
|
firstValue);
|
|
635
|
-
|
|
622
|
+
addBugToRecoder(bug, curNode);
|
|
636
623
|
return false;
|
|
637
624
|
}
|
|
638
625
|
else
|
|
@@ -673,7 +660,7 @@ bool BufOverflowCheckerAPI::canSafelyAccessMemory(const SVFValue *value, const I
|
|
|
673
660
|
BufOverflowException bug(SVFUtil::wrnMsg(msg), arr_type_size, arr_type_size,
|
|
674
661
|
total_bytes.lb().getNumeral(), total_bytes.ub().getNumeral(),
|
|
675
662
|
firstValue);
|
|
676
|
-
|
|
663
|
+
addBugToRecoder(bug, curNode);
|
|
677
664
|
return false;
|
|
678
665
|
}
|
|
679
666
|
else
|
|
@@ -713,7 +700,7 @@ bool BufOverflowCheckerAPI::canSafelyAccessMemory(const SVFValue *value, const I
|
|
|
713
700
|
|
|
714
701
|
BufOverflowException bug(SVFUtil::wrnMsg(msg), arr_type_size, arr_type_size,
|
|
715
702
|
total_bytes.lb().getNumeral(), total_bytes.ub().getNumeral(), firstValue);
|
|
716
|
-
|
|
703
|
+
addBugToRecoder(bug, curNode);
|
|
717
704
|
return false;
|
|
718
705
|
}
|
|
719
706
|
else
|
|
@@ -749,8 +736,6 @@ void BufOverflowChecker::handleICFGNode(const SVF::ICFGNode *node)
|
|
|
749
736
|
//
|
|
750
737
|
bool BufOverflowChecker::detectBufOverflow(const ICFGNode *node)
|
|
751
738
|
{
|
|
752
|
-
|
|
753
|
-
auto *extapi = SVFUtil::dyn_cast<BufOverflowCheckerAPI>(_api);
|
|
754
739
|
for (auto* stmt: node->getSVFStmts())
|
|
755
740
|
{
|
|
756
741
|
if (const GepStmt *gep = SVFUtil::dyn_cast<GepStmt>(stmt))
|
|
@@ -763,7 +748,7 @@ bool BufOverflowChecker::detectBufOverflow(const ICFGNode *node)
|
|
|
763
748
|
{
|
|
764
749
|
if (const GepStmt *gep2 = SVFUtil::dyn_cast<GepStmt>(stmt2))
|
|
765
750
|
{
|
|
766
|
-
return
|
|
751
|
+
return canSafelyAccessMemory(gep2->getLHSVar()->getValue(), IntervalValue(0, 0), node);
|
|
767
752
|
}
|
|
768
753
|
}
|
|
769
754
|
}
|
|
@@ -776,10 +761,10 @@ bool BufOverflowChecker::detectBufOverflow(const ICFGNode *node)
|
|
|
776
761
|
for (auto vaddr: Addrs)
|
|
777
762
|
{
|
|
778
763
|
u32_t objId = _svfir2ExeState->getInternalID(vaddr);
|
|
779
|
-
if (
|
|
764
|
+
if (_addrToGep.find(objId) != _addrToGep.end())
|
|
780
765
|
{
|
|
781
|
-
const GepStmt* gep =
|
|
782
|
-
return
|
|
766
|
+
const GepStmt* gep = _addrToGep.at(objId);
|
|
767
|
+
return canSafelyAccessMemory(gep->getLHSVar()->getValue(), IntervalValue(0, 0), node);
|
|
783
768
|
}
|
|
784
769
|
}
|
|
785
770
|
}
|
|
@@ -792,10 +777,10 @@ bool BufOverflowChecker::detectBufOverflow(const ICFGNode *node)
|
|
|
792
777
|
for (auto vaddr: Addrs)
|
|
793
778
|
{
|
|
794
779
|
u32_t objId = _svfir2ExeState->getInternalID(vaddr);
|
|
795
|
-
if (
|
|
780
|
+
if (_addrToGep.find(objId) != _addrToGep.end())
|
|
796
781
|
{
|
|
797
|
-
const GepStmt* gep =
|
|
798
|
-
return
|
|
782
|
+
const GepStmt* gep = _addrToGep.at(objId);
|
|
783
|
+
return canSafelyAccessMemory(gep->getLHSVar()->getValue(), IntervalValue(0, 0), node);
|
|
799
784
|
}
|
|
800
785
|
}
|
|
801
786
|
}
|
package/svf-llvm/tools/AE/ae.cpp
CHANGED
|
@@ -663,13 +663,12 @@ int main(int argc, char** argv)
|
|
|
663
663
|
if (Options::BufferOverflowCheck())
|
|
664
664
|
{
|
|
665
665
|
BufOverflowChecker ae;
|
|
666
|
-
ae.initExtAPI();
|
|
667
666
|
ae.runOnModule(pag->getICFG());
|
|
668
667
|
}
|
|
669
668
|
else
|
|
670
669
|
{
|
|
671
670
|
AbstractExecution ae;
|
|
672
|
-
|
|
671
|
+
|
|
673
672
|
ae.runOnModule(pag->getICFG());
|
|
674
673
|
}
|
|
675
674
|
|