svf-tools 1.0.913 → 1.0.915

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.
Files changed (264) hide show
  1. package/SVF-doxygen/html/AbstractInterpretation_8cpp.html +7 -5
  2. package/SVF-doxygen/html/AbstractInterpretation_8cpp_source.html +1593 -1610
  3. package/SVF-doxygen/html/AbstractInterpretation_8h_source.html +157 -144
  4. package/SVF-doxygen/html/BufOverflowChecker_8cpp_source.html +797 -786
  5. package/SVF-doxygen/html/BufOverflowChecker_8h_source.html +7 -7
  6. package/SVF-doxygen/html/SVFIR2AbsState_8cpp_source.html +815 -826
  7. package/SVF-doxygen/html/SVFIR2AbsState_8h_source.html +153 -196
  8. package/SVF-doxygen/html/classSVF_1_1AEStat.html +116 -120
  9. package/SVF-doxygen/html/classSVF_1_1AbstractInterpretation-members.html +33 -33
  10. package/SVF-doxygen/html/classSVF_1_1AbstractInterpretation.html +1739 -1684
  11. package/SVF-doxygen/html/classSVF_1_1BufOverflowChecker-members.html +33 -33
  12. package/SVF-doxygen/html/classSVF_1_1BufOverflowChecker.html +471 -462
  13. package/SVF-doxygen/html/classSVF_1_1SVFIR2AbsState-members.html +35 -47
  14. package/SVF-doxygen/html/classSVF_1_1SVFIR2AbsState.html +1261 -1546
  15. package/SVF-doxygen/html/dir_9a8e7a56f4029a0d9f62b1c6d1f6e85b.html +0 -2
  16. package/SVF-doxygen/html/files.html +0 -1
  17. package/SVF-doxygen/html/functions.html +4 -7
  18. package/SVF-doxygen/html/functions_a.html +2 -2
  19. package/SVF-doxygen/html/functions_f.html +3 -3
  20. package/SVF-doxygen/html/functions_func.html +2 -2
  21. package/SVF-doxygen/html/functions_func_g.html +16 -16
  22. package/SVF-doxygen/html/functions_func_h.html +21 -57
  23. package/SVF-doxygen/html/functions_func_i.html +21 -12
  24. package/SVF-doxygen/html/functions_func_n.html +1 -1
  25. package/SVF-doxygen/html/functions_func_s.html +13 -19
  26. package/SVF-doxygen/html/functions_func_t.html +1 -1
  27. package/SVF-doxygen/html/functions_func_w.html +1 -1
  28. package/SVF-doxygen/html/functions_g.html +16 -16
  29. package/SVF-doxygen/html/functions_h.html +18 -54
  30. package/SVF-doxygen/html/functions_i.html +32 -23
  31. package/SVF-doxygen/html/functions_l.html +3 -3
  32. package/SVF-doxygen/html/functions_n.html +1 -1
  33. package/SVF-doxygen/html/functions_o.html +4 -4
  34. package/SVF-doxygen/html/functions_p.html +19 -17
  35. package/SVF-doxygen/html/functions_r.html +6 -6
  36. package/SVF-doxygen/html/functions_s.html +18 -26
  37. package/SVF-doxygen/html/functions_t.html +4 -4
  38. package/SVF-doxygen/html/functions_v.html +6 -6
  39. package/SVF-doxygen/html/functions_vars.html +4 -7
  40. package/SVF-doxygen/html/functions_w.html +1 -1
  41. package/SVF-doxygen/html/search/all_0.js +131 -132
  42. package/SVF-doxygen/html/search/all_1.js +504 -504
  43. package/SVF-doxygen/html/search/all_10.js +326 -326
  44. package/SVF-doxygen/html/search/all_11.js +227 -227
  45. package/SVF-doxygen/html/search/all_12.js +559 -562
  46. package/SVF-doxygen/html/search/all_13.js +186 -186
  47. package/SVF-doxygen/html/search/all_14.js +74 -74
  48. package/SVF-doxygen/html/search/all_15.js +175 -175
  49. package/SVF-doxygen/html/search/all_16.js +77 -77
  50. package/SVF-doxygen/html/search/all_17.js +1 -1
  51. package/SVF-doxygen/html/search/all_18.js +1 -1
  52. package/SVF-doxygen/html/search/all_19.js +27 -27
  53. package/SVF-doxygen/html/search/all_1a.js +174 -174
  54. package/SVF-doxygen/html/search/all_2.js +180 -180
  55. package/SVF-doxygen/html/search/all_3.js +635 -635
  56. package/SVF-doxygen/html/search/all_4.js +237 -237
  57. package/SVF-doxygen/html/search/all_5.js +120 -120
  58. package/SVF-doxygen/html/search/all_6.js +236 -236
  59. package/SVF-doxygen/html/search/all_7.js +1039 -1039
  60. package/SVF-doxygen/html/search/all_8.js +212 -224
  61. package/SVF-doxygen/html/search/all_9.js +630 -627
  62. package/SVF-doxygen/html/search/all_a.js +46 -46
  63. package/SVF-doxygen/html/search/all_b.js +24 -24
  64. package/SVF-doxygen/html/search/all_c.js +111 -111
  65. package/SVF-doxygen/html/search/all_d.js +204 -204
  66. package/SVF-doxygen/html/search/all_e.js +207 -207
  67. package/SVF-doxygen/html/search/all_f.js +122 -122
  68. package/SVF-doxygen/html/search/classes_0.js +29 -29
  69. package/SVF-doxygen/html/search/classes_1.js +11 -11
  70. package/SVF-doxygen/html/search/classes_10.js +71 -71
  71. package/SVF-doxygen/html/search/classes_11.js +14 -14
  72. package/SVF-doxygen/html/search/classes_12.js +2 -2
  73. package/SVF-doxygen/html/search/classes_13.js +10 -10
  74. package/SVF-doxygen/html/search/classes_14.js +19 -19
  75. package/SVF-doxygen/html/search/classes_15.js +1 -1
  76. package/SVF-doxygen/html/search/classes_2.js +72 -72
  77. package/SVF-doxygen/html/search/classes_3.js +35 -35
  78. package/SVF-doxygen/html/search/classes_4.js +7 -7
  79. package/SVF-doxygen/html/search/classes_5.js +28 -28
  80. package/SVF-doxygen/html/search/classes_6.js +98 -98
  81. package/SVF-doxygen/html/search/classes_7.js +33 -33
  82. package/SVF-doxygen/html/search/classes_8.js +57 -57
  83. package/SVF-doxygen/html/search/classes_9.js +1 -1
  84. package/SVF-doxygen/html/search/classes_a.js +12 -12
  85. package/SVF-doxygen/html/search/classes_b.js +29 -29
  86. package/SVF-doxygen/html/search/classes_c.js +6 -6
  87. package/SVF-doxygen/html/search/classes_d.js +19 -19
  88. package/SVF-doxygen/html/search/classes_e.js +36 -36
  89. package/SVF-doxygen/html/search/classes_f.js +25 -25
  90. package/SVF-doxygen/html/search/defines_0.js +3 -3
  91. package/SVF-doxygen/html/search/defines_1.js +3 -3
  92. package/SVF-doxygen/html/search/defines_10.js +2 -2
  93. package/SVF-doxygen/html/search/defines_2.js +30 -30
  94. package/SVF-doxygen/html/search/defines_3.js +20 -20
  95. package/SVF-doxygen/html/search/defines_4.js +3 -3
  96. package/SVF-doxygen/html/search/defines_5.js +4 -4
  97. package/SVF-doxygen/html/search/defines_6.js +2 -2
  98. package/SVF-doxygen/html/search/defines_7.js +5 -5
  99. package/SVF-doxygen/html/search/defines_8.js +11 -11
  100. package/SVF-doxygen/html/search/defines_9.js +9 -9
  101. package/SVF-doxygen/html/search/defines_a.js +2 -2
  102. package/SVF-doxygen/html/search/defines_b.js +1 -1
  103. package/SVF-doxygen/html/search/defines_c.js +3 -3
  104. package/SVF-doxygen/html/search/defines_d.js +2 -2
  105. package/SVF-doxygen/html/search/defines_e.js +8 -8
  106. package/SVF-doxygen/html/search/defines_f.js +4 -4
  107. package/SVF-doxygen/html/search/enums_0.js +3 -3
  108. package/SVF-doxygen/html/search/enums_1.js +2 -2
  109. package/SVF-doxygen/html/search/enums_10.js +1 -1
  110. package/SVF-doxygen/html/search/enums_11.js +1 -1
  111. package/SVF-doxygen/html/search/enums_2.js +9 -9
  112. package/SVF-doxygen/html/search/enums_3.js +2 -2
  113. package/SVF-doxygen/html/search/enums_4.js +3 -3
  114. package/SVF-doxygen/html/search/enums_5.js +1 -1
  115. package/SVF-doxygen/html/search/enums_6.js +2 -2
  116. package/SVF-doxygen/html/search/enums_7.js +2 -2
  117. package/SVF-doxygen/html/search/enums_8.js +4 -4
  118. package/SVF-doxygen/html/search/enums_9.js +1 -1
  119. package/SVF-doxygen/html/search/enums_a.js +1 -1
  120. package/SVF-doxygen/html/search/enums_b.js +7 -7
  121. package/SVF-doxygen/html/search/enums_c.js +1 -1
  122. package/SVF-doxygen/html/search/enums_d.js +4 -4
  123. package/SVF-doxygen/html/search/enums_e.js +2 -2
  124. package/SVF-doxygen/html/search/enums_f.js +4 -4
  125. package/SVF-doxygen/html/search/enumvalues_0.js +15 -15
  126. package/SVF-doxygen/html/search/enumvalues_1.js +16 -16
  127. package/SVF-doxygen/html/search/enumvalues_10.js +36 -36
  128. package/SVF-doxygen/html/search/enumvalues_11.js +6 -6
  129. package/SVF-doxygen/html/search/enumvalues_12.js +10 -10
  130. package/SVF-doxygen/html/search/enumvalues_13.js +1 -1
  131. package/SVF-doxygen/html/search/enumvalues_14.js +1 -1
  132. package/SVF-doxygen/html/search/enumvalues_15.js +4 -4
  133. package/SVF-doxygen/html/search/enumvalues_2.js +36 -36
  134. package/SVF-doxygen/html/search/enumvalues_3.js +13 -13
  135. package/SVF-doxygen/html/search/enumvalues_4.js +2 -2
  136. package/SVF-doxygen/html/search/enumvalues_5.js +50 -50
  137. package/SVF-doxygen/html/search/enumvalues_6.js +6 -6
  138. package/SVF-doxygen/html/search/enumvalues_7.js +8 -8
  139. package/SVF-doxygen/html/search/enumvalues_8.js +24 -24
  140. package/SVF-doxygen/html/search/enumvalues_9.js +6 -6
  141. package/SVF-doxygen/html/search/enumvalues_a.js +17 -17
  142. package/SVF-doxygen/html/search/enumvalues_b.js +11 -11
  143. package/SVF-doxygen/html/search/enumvalues_c.js +5 -5
  144. package/SVF-doxygen/html/search/enumvalues_d.js +19 -19
  145. package/SVF-doxygen/html/search/enumvalues_e.js +9 -9
  146. package/SVF-doxygen/html/search/enumvalues_f.js +48 -48
  147. package/SVF-doxygen/html/search/files_0.js +18 -18
  148. package/SVF-doxygen/html/search/files_1.js +9 -9
  149. package/SVF-doxygen/html/search/files_10.js +8 -8
  150. package/SVF-doxygen/html/search/files_11.js +8 -8
  151. package/SVF-doxygen/html/search/files_12.js +2 -2
  152. package/SVF-doxygen/html/search/files_2.js +51 -51
  153. package/SVF-doxygen/html/search/files_3.js +14 -14
  154. package/SVF-doxygen/html/search/files_4.js +3 -3
  155. package/SVF-doxygen/html/search/files_5.js +13 -13
  156. package/SVF-doxygen/html/search/files_6.js +10 -10
  157. package/SVF-doxygen/html/search/files_7.js +15 -15
  158. package/SVF-doxygen/html/search/files_8.js +13 -13
  159. package/SVF-doxygen/html/search/files_9.js +18 -18
  160. package/SVF-doxygen/html/search/files_a.js +3 -3
  161. package/SVF-doxygen/html/search/files_b.js +4 -4
  162. package/SVF-doxygen/html/search/files_c.js +20 -20
  163. package/SVF-doxygen/html/search/files_d.js +4 -4
  164. package/SVF-doxygen/html/search/files_e.js +56 -57
  165. package/SVF-doxygen/html/search/files_f.js +8 -8
  166. package/SVF-doxygen/html/search/functions_0.js +13 -13
  167. package/SVF-doxygen/html/search/functions_1.js +366 -366
  168. package/SVF-doxygen/html/search/functions_10.js +140 -140
  169. package/SVF-doxygen/html/search/functions_11.js +140 -140
  170. package/SVF-doxygen/html/search/functions_12.js +291 -293
  171. package/SVF-doxygen/html/search/functions_13.js +52 -52
  172. package/SVF-doxygen/html/search/functions_14.js +41 -41
  173. package/SVF-doxygen/html/search/functions_15.js +70 -70
  174. package/SVF-doxygen/html/search/functions_16.js +38 -38
  175. package/SVF-doxygen/html/search/functions_17.js +3 -3
  176. package/SVF-doxygen/html/search/functions_18.js +174 -174
  177. package/SVF-doxygen/html/search/functions_2.js +92 -92
  178. package/SVF-doxygen/html/search/functions_3.js +257 -257
  179. package/SVF-doxygen/html/search/functions_4.js +85 -85
  180. package/SVF-doxygen/html/search/functions_5.js +54 -54
  181. package/SVF-doxygen/html/search/functions_6.js +65 -65
  182. package/SVF-doxygen/html/search/functions_7.js +857 -857
  183. package/SVF-doxygen/html/search/functions_8.js +164 -176
  184. package/SVF-doxygen/html/search/functions_9.js +439 -436
  185. package/SVF-doxygen/html/search/functions_a.js +30 -30
  186. package/SVF-doxygen/html/search/functions_b.js +2 -2
  187. package/SVF-doxygen/html/search/functions_c.js +22 -22
  188. package/SVF-doxygen/html/search/functions_d.js +81 -81
  189. package/SVF-doxygen/html/search/functions_e.js +34 -34
  190. package/SVF-doxygen/html/search/functions_f.js +58 -58
  191. package/SVF-doxygen/html/search/namespaces_0.js +1 -1
  192. package/SVF-doxygen/html/search/namespaces_1.js +7 -7
  193. package/SVF-doxygen/html/search/related_0.js +4 -4
  194. package/SVF-doxygen/html/search/related_1.js +2 -2
  195. package/SVF-doxygen/html/search/related_2.js +2 -2
  196. package/SVF-doxygen/html/search/related_3.js +2 -2
  197. package/SVF-doxygen/html/search/related_4.js +2 -2
  198. package/SVF-doxygen/html/search/related_5.js +1 -1
  199. package/SVF-doxygen/html/search/related_6.js +2 -2
  200. package/SVF-doxygen/html/search/related_7.js +5 -5
  201. package/SVF-doxygen/html/search/related_8.js +2 -2
  202. package/SVF-doxygen/html/search/related_9.js +4 -4
  203. package/SVF-doxygen/html/search/related_a.js +19 -19
  204. package/SVF-doxygen/html/search/related_b.js +4 -4
  205. package/SVF-doxygen/html/search/related_c.js +2 -2
  206. package/SVF-doxygen/html/search/related_d.js +11 -11
  207. package/SVF-doxygen/html/search/related_e.js +2 -2
  208. package/SVF-doxygen/html/search/related_f.js +2 -2
  209. package/SVF-doxygen/html/search/typedefs_0.js +20 -20
  210. package/SVF-doxygen/html/search/typedefs_1.js +27 -27
  211. package/SVF-doxygen/html/search/typedefs_10.js +65 -65
  212. package/SVF-doxygen/html/search/typedefs_11.js +12 -12
  213. package/SVF-doxygen/html/search/typedefs_12.js +13 -13
  214. package/SVF-doxygen/html/search/typedefs_13.js +40 -40
  215. package/SVF-doxygen/html/search/typedefs_14.js +11 -11
  216. package/SVF-doxygen/html/search/typedefs_2.js +125 -125
  217. package/SVF-doxygen/html/search/typedefs_3.js +39 -39
  218. package/SVF-doxygen/html/search/typedefs_4.js +17 -17
  219. package/SVF-doxygen/html/search/typedefs_5.js +42 -42
  220. package/SVF-doxygen/html/search/typedefs_6.js +54 -54
  221. package/SVF-doxygen/html/search/typedefs_7.js +47 -47
  222. package/SVF-doxygen/html/search/typedefs_8.js +1 -1
  223. package/SVF-doxygen/html/search/typedefs_9.js +4 -4
  224. package/SVF-doxygen/html/search/typedefs_a.js +28 -28
  225. package/SVF-doxygen/html/search/typedefs_b.js +29 -29
  226. package/SVF-doxygen/html/search/typedefs_c.js +41 -41
  227. package/SVF-doxygen/html/search/typedefs_d.js +15 -15
  228. package/SVF-doxygen/html/search/typedefs_e.js +52 -52
  229. package/SVF-doxygen/html/search/typedefs_f.js +14 -14
  230. package/SVF-doxygen/html/search/variables_0.js +169 -170
  231. package/SVF-doxygen/html/search/variables_1.js +78 -78
  232. package/SVF-doxygen/html/search/variables_10.js +98 -98
  233. package/SVF-doxygen/html/search/variables_11.js +47 -47
  234. package/SVF-doxygen/html/search/variables_12.js +93 -93
  235. package/SVF-doxygen/html/search/variables_13.js +76 -76
  236. package/SVF-doxygen/html/search/variables_14.js +14 -14
  237. package/SVF-doxygen/html/search/variables_15.js +49 -49
  238. package/SVF-doxygen/html/search/variables_16.js +11 -11
  239. package/SVF-doxygen/html/search/variables_17.js +1 -1
  240. package/SVF-doxygen/html/search/variables_18.js +17 -17
  241. package/SVF-doxygen/html/search/variables_2.js +40 -40
  242. package/SVF-doxygen/html/search/variables_3.js +143 -143
  243. package/SVF-doxygen/html/search/variables_4.js +51 -51
  244. package/SVF-doxygen/html/search/variables_5.js +39 -39
  245. package/SVF-doxygen/html/search/variables_6.js +66 -66
  246. package/SVF-doxygen/html/search/variables_7.js +32 -32
  247. package/SVF-doxygen/html/search/variables_8.js +8 -8
  248. package/SVF-doxygen/html/search/variables_9.js +80 -80
  249. package/SVF-doxygen/html/search/variables_a.js +4 -4
  250. package/SVF-doxygen/html/search/variables_b.js +10 -10
  251. package/SVF-doxygen/html/search/variables_c.js +44 -44
  252. package/SVF-doxygen/html/search/variables_d.js +58 -58
  253. package/SVF-doxygen/html/search/variables_e.js +123 -123
  254. package/SVF-doxygen/html/search/variables_f.js +31 -31
  255. package/SVF-doxygen/html/svf-ex_8cpp.html +199 -197
  256. package/SVF-doxygen/html/svf-ex_8cpp_source.html +204 -202
  257. package/package.json +1 -1
  258. package/svf/include/AE/Svfexe/AbstractInterpretation.h +28 -21
  259. package/svf/include/AE/Svfexe/SVFIR2AbsState.h +37 -67
  260. package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +153 -169
  261. package/svf/lib/AE/Svfexe/BufOverflowChecker.cpp +64 -54
  262. package/svf/lib/AE/Svfexe/SVFIR2AbsState.cpp +134 -146
  263. package/svf-llvm/tools/Example/svf-ex.cpp +13 -12
  264. package/svf/lib/AE/Core/SVFIR2Relation.cpp +0 -193
@@ -153,7 +153,7 @@ void AbstractInterpretation::analyse()
153
153
  {
154
154
  // handle Global ICFGNode of SVFModule
155
155
  handleGlobalNode();
156
- _svfir2AbsState->getAbsState()[PAG::getPAG()->getBlkPtr()] = IntervalValue::top();
156
+ getAbsState(_icfg->getGlobalICFGNode())[PAG::getPAG()->getBlkPtr()] = IntervalValue::top();
157
157
  if (const SVFFunction* fun = _svfir->getModule()->getSVFFunction("main"))
158
158
  {
159
159
  handleFunc(fun);
@@ -163,15 +163,14 @@ void AbstractInterpretation::analyse()
163
163
  /// handle global node
164
164
  void AbstractInterpretation::handleGlobalNode()
165
165
  {
166
- AbstractState es;
166
+ AbstractState as;
167
167
  const ICFGNode* node = _icfg->getGlobalICFGNode();
168
- _svfir2AbsState->setEs(es);
168
+ _postAbsTrace[node] = _preAbsTrace[node];
169
169
  // Global Node, we just need to handle addr, load, store, copy and gep
170
170
  for (const SVFStmt *stmt: node->getSVFStmts())
171
171
  {
172
172
  handleSVFStatement(stmt);
173
173
  }
174
- _postAbstractTrace[node] = _svfir2AbsState->getAbsState();
175
174
  }
176
175
 
177
176
  /// get execution state by merging states of predecessor blocks
@@ -179,21 +178,19 @@ void AbstractInterpretation::handleGlobalNode()
179
178
  /// Scenario 2: preblock -----(callEdge)----> block
180
179
  bool AbstractInterpretation::propagateStateIfFeasible(const ICFGNode *block)
181
180
  {
182
- AbstractState es;
181
+ AbstractState as;
183
182
  u32_t inEdgeNum = 0;
184
183
  for (auto& edge: block->getInEdges())
185
184
  {
186
- if (_postAbstractTrace.find(edge->getSrcNode()) !=
187
- _postAbstractTrace.end())
185
+ if (_postAbsTrace.find(edge->getSrcNode()) != _postAbsTrace.end())
188
186
  {
189
187
  const IntraCFGEdge *intraCfgEdge = SVFUtil::dyn_cast<IntraCFGEdge>(edge);
190
188
  if (intraCfgEdge && intraCfgEdge->getCondition())
191
189
  {
192
- AbstractState tmpEs =
193
- _postAbstractTrace[edge->getSrcNode()];
194
- if (hasBranchES(intraCfgEdge, tmpEs))
190
+ AbstractState tmpEs = _postAbsTrace[edge->getSrcNode()];
191
+ if (isBranchFeasible(intraCfgEdge, tmpEs))
195
192
  {
196
- es.joinWith(tmpEs);
193
+ as.joinWith(tmpEs);
197
194
  inEdgeNum++;
198
195
  }
199
196
  else
@@ -203,7 +200,7 @@ bool AbstractInterpretation::propagateStateIfFeasible(const ICFGNode *block)
203
200
  }
204
201
  else
205
202
  {
206
- es.joinWith(_postAbstractTrace[edge->getSrcNode()]);
203
+ as.joinWith(_postAbsTrace[edge->getSrcNode()]);
207
204
  inEdgeNum++;
208
205
  }
209
206
  }
@@ -218,17 +215,17 @@ bool AbstractInterpretation::propagateStateIfFeasible(const ICFGNode *block)
218
215
  }
219
216
  else
220
217
  {
221
- _preAbstractTrace[block] = es;
218
+ _preAbsTrace[block] = as;
222
219
  return true;
223
220
  }
224
221
  assert(false && "implement this part");
225
222
  }
226
223
 
227
224
 
228
- bool AbstractInterpretation::hasCmpBranchES(const CmpStmt* cmpStmt, s64_t succ,
229
- AbstractState& es)
225
+ bool AbstractInterpretation::isCmpBranchFeasible(const CmpStmt* cmpStmt, s64_t succ,
226
+ AbstractState& as)
230
227
  {
231
- AbstractState new_es = es;
228
+ AbstractState new_es = as;
232
229
  // get cmp stmt's op0, op1, and predicate
233
230
  NodeID op0 = cmpStmt->getOpVarID(0);
234
231
  NodeID op1 = cmpStmt->getOpVarID(1);
@@ -239,7 +236,7 @@ bool AbstractInterpretation::hasCmpBranchES(const CmpStmt* cmpStmt, s64_t succ,
239
236
  // skip address compare
240
237
  if (new_es.inVarToAddrsTable(op0) || new_es.inVarToAddrsTable(op1))
241
238
  {
242
- es = new_es;
239
+ as = new_es;
243
240
  return true;
244
241
  }
245
242
  const LoadStmt *load_op0 = nullptr;
@@ -313,13 +310,13 @@ bool AbstractInterpretation::hasCmpBranchES(const CmpStmt* cmpStmt, s64_t succ,
313
310
  // if var X var, we cannot preset the branch condition to infer the intervals of var0,var1
314
311
  if (!b0 && !b1)
315
312
  {
316
- es = new_es;
313
+ as = new_es;
317
314
  return true;
318
315
  }
319
316
  // if const X const, we can instantly get the resVal
320
317
  else if (b0 && b1)
321
318
  {
322
- es = new_es;
319
+ as = new_es;
323
320
  return true;
324
321
  }
325
322
  }
@@ -442,14 +439,14 @@ bool AbstractInterpretation::hasCmpBranchES(const CmpStmt* cmpStmt, s64_t succ,
442
439
  assert(false && "implement this part");
443
440
  abort();
444
441
  }
445
- es = new_es;
442
+ as = new_es;
446
443
  return true;
447
444
  }
448
445
 
449
- bool AbstractInterpretation::hasSwitchBranchES(const SVFVar* var, s64_t succ,
450
- AbstractState& es)
446
+ bool AbstractInterpretation::isSwitchBranchFeasible(const SVFVar* var, s64_t succ,
447
+ AbstractState& as)
451
448
  {
452
- AbstractState new_es = es;
449
+ AbstractState new_es = as;
453
450
  IntervalValue& switch_cond = new_es[var->getId()].getInterval();
454
451
  s64_t value = succ;
455
452
  FIFOWorkList<const SVFStmt*> workList;
@@ -486,19 +483,20 @@ bool AbstractInterpretation::hasSwitchBranchES(const SVFVar* var, s64_t succ,
486
483
  }
487
484
  }
488
485
  }
489
- es = new_es;
486
+ as = new_es;
490
487
  return true;
491
488
  }
492
489
 
493
- bool AbstractInterpretation::hasBranchES(const IntraCFGEdge* intraEdge,
494
- AbstractState& es)
490
+ bool AbstractInterpretation::isBranchFeasible(const IntraCFGEdge* intraEdge,
491
+ AbstractState& as)
495
492
  {
496
493
  const SVFValue *cond = intraEdge->getCondition();
497
494
  NodeID cmpID = _svfir->getValueNode(cond);
498
495
  SVFVar *cmpVar = _svfir->getGNode(cmpID);
499
496
  if (cmpVar->getInEdges().empty())
500
497
  {
501
- return hasSwitchBranchES(cmpVar, intraEdge->getSuccessorCondValue(), es);
498
+ return isSwitchBranchFeasible(cmpVar,
499
+ intraEdge->getSuccessorCondValue(), as);
502
500
  }
503
501
  else
504
502
  {
@@ -507,11 +505,13 @@ bool AbstractInterpretation::hasBranchES(const IntraCFGEdge* intraEdge,
507
505
  SVFStmt *cmpVarInStmt = *cmpVar->getInEdges().begin();
508
506
  if (const CmpStmt *cmpStmt = SVFUtil::dyn_cast<CmpStmt>(cmpVarInStmt))
509
507
  {
510
- return hasCmpBranchES(cmpStmt, intraEdge->getSuccessorCondValue(), es);
508
+ return isCmpBranchFeasible(cmpStmt,
509
+ intraEdge->getSuccessorCondValue(), as);
511
510
  }
512
511
  else
513
512
  {
514
- return hasSwitchBranchES(cmpVar, intraEdge->getSuccessorCondValue(), es);
513
+ return isSwitchBranchFeasible(
514
+ cmpVar, intraEdge->getSuccessorCondValue(), as);
515
515
  }
516
516
  }
517
517
  return true;
@@ -530,7 +530,7 @@ void AbstractInterpretation::handleWTONode(const ICFGNode *node)
530
530
  {
531
531
  // Has ES on the in edges - Feasible block
532
532
  // Get execution state from in edges
533
- _svfir2AbsState->setEs(_preAbstractTrace[node]);
533
+ _postAbsTrace[node] = _preAbsTrace[node];
534
534
  }
535
535
 
536
536
  std::deque<const ICFGNode*> worklist;
@@ -541,9 +541,6 @@ void AbstractInterpretation::handleWTONode(const ICFGNode *node)
541
541
  const ICFGNode* curNode = *it;
542
542
  handleICFGNode(curNode);
543
543
  }
544
-
545
- _preAbstractTrace.erase(node);
546
- _postAbstractTrace[node] = _svfir2AbsState->getAbsState();
547
544
  }
548
545
 
549
546
  void AbstractInterpretation::handleCallSite(const ICFGNode* node)
@@ -598,6 +595,7 @@ bool AbstractInterpretation::isRecursiveCall(const SVF::CallICFGNode *callNode)
598
595
 
599
596
  void AbstractInterpretation::recursiveCallPass(const SVF::CallICFGNode *callNode)
600
597
  {
598
+ AbstractState& as = getAbsState(callNode);
601
599
  SkipRecursiveCall(callNode);
602
600
  const RetICFGNode *retNode = callNode->getRetICFGNode();
603
601
  if (retNode->getSVFStmts().size() > 0)
@@ -607,11 +605,11 @@ void AbstractInterpretation::recursiveCallPass(const SVF::CallICFGNode *callNode
607
605
  if (!retPE->getLHSVar()->isPointer() &&
608
606
  !retPE->getLHSVar()->isConstDataOrAggDataButNotNullPtr())
609
607
  {
610
- _svfir2AbsState->getAbsState()[retPE->getLHSVarID()] = IntervalValue::top();
608
+ as[retPE->getLHSVarID()] = IntervalValue::top();
611
609
  }
612
610
  }
613
611
  }
614
- _postAbstractTrace[retNode] = _svfir2AbsState->getAbsState();
612
+ _postAbsTrace[retNode] = as;
615
613
  }
616
614
 
617
615
  bool AbstractInterpretation::isDirectCall(const SVF::CallICFGNode *callNode)
@@ -621,18 +619,18 @@ bool AbstractInterpretation::isDirectCall(const SVF::CallICFGNode *callNode)
621
619
  }
622
620
  void AbstractInterpretation::directCallFunPass(const SVF::CallICFGNode *callNode)
623
621
  {
622
+ AbstractState& as = getAbsState(callNode);
624
623
  const SVFFunction *callfun = SVFUtil::getCallee(callNode->getCallSite());
625
- AbstractState preES = _svfir2AbsState->getAbsState();
626
624
  _callSiteStack.push_back(callNode);
627
625
 
628
- _postAbstractTrace[callNode] = _svfir2AbsState->getAbsState();
626
+ _postAbsTrace[callNode] = as;
629
627
 
630
628
  handleFunc(callfun);
631
629
  _callSiteStack.pop_back();
632
630
  // handle Ret node
633
631
  const RetICFGNode *retNode = callNode->getRetICFGNode();
634
632
  // resume ES to callnode
635
- _postAbstractTrace[retNode] = _postAbstractTrace[callNode];
633
+ _postAbsTrace[retNode] = _postAbsTrace[callNode];
636
634
  }
637
635
 
638
636
  bool AbstractInterpretation::isIndirectCall(const SVF::CallICFGNode *callNode)
@@ -643,29 +641,28 @@ bool AbstractInterpretation::isIndirectCall(const SVF::CallICFGNode *callNode)
643
641
 
644
642
  void AbstractInterpretation::indirectCallFunPass(const SVF::CallICFGNode *callNode)
645
643
  {
644
+ AbstractState& as = getAbsState(callNode);
646
645
  const auto callsiteMaps = _svfir->getIndirectCallsites();
647
646
  NodeID call_id = callsiteMaps.at(callNode);
648
- if (!_svfir2AbsState->getAbsState().inVarToAddrsTable(call_id))
647
+ if (!as.inVarToAddrsTable(call_id))
649
648
  {
650
649
  return;
651
650
  }
652
651
  AbstractValue Addrs =
653
- _svfir2AbsState->getAddrs(call_id); //_svfir2ExeState->getEs()
652
+ _svfir2AbsState->getAddrs(as, call_id); //_svfir2ExeState->getEs()
654
653
  NodeID addr = *Addrs.getAddrs().begin();
655
- SVFVar *func_var = _svfir->getGNode(_svfir2AbsState->getInternalID(addr));
654
+ SVFVar *func_var = _svfir->getGNode(AbstractState::getInternalID(addr));
656
655
  const SVFFunction *callfun = SVFUtil::dyn_cast<SVFFunction>(func_var->getValue());
657
656
  if (callfun)
658
657
  {
659
- AbstractState preES = _svfir2AbsState->getAbsState();
660
658
  _callSiteStack.push_back(callNode);
661
-
662
- _postAbstractTrace[callNode] = _svfir2AbsState->getAbsState();
659
+ _postAbsTrace[callNode] = as;
663
660
 
664
661
  handleFunc(callfun);
665
662
  _callSiteStack.pop_back();
666
663
  // handle Ret node
667
664
  const RetICFGNode *retNode = callNode->getRetICFGNode();
668
- _postAbstractTrace[retNode] = _postAbstractTrace[callNode];
665
+ _postAbsTrace[retNode] = _postAbsTrace[callNode];
669
666
  }
670
667
  }
671
668
 
@@ -700,7 +697,7 @@ void AbstractInterpretation::handleCycle(const ICFGWTOCycle *cycle)
700
697
  // No ES on the in edges - Infeasible block
701
698
  return;
702
699
  }
703
- AbstractState pre_es = _preAbstractTrace[cycle->head()];
700
+ AbstractState pre_es = _preAbsTrace[cycle->head()];
704
701
  // set -widen-delay
705
702
  s32_t widen_delay = Options::WidenDelay();
706
703
  bool incresing = true;
@@ -711,11 +708,11 @@ void AbstractInterpretation::handleCycle(const ICFGWTOCycle *cycle)
711
708
  handleWTONode(cycle_head);
712
709
  if (i < widen_delay)
713
710
  {
714
- if (i> 0 && pre_es >= _postAbstractTrace[cycle_head])
711
+ if (i> 0 && pre_es >= _postAbsTrace[cycle_head])
715
712
  {
716
713
  break;
717
714
  }
718
- pre_es = _postAbstractTrace[cycle_head];
715
+ pre_es = _postAbsTrace[cycle_head];
719
716
  }
720
717
  else
721
718
  {
@@ -761,21 +758,21 @@ bool AbstractInterpretation::widenFixpointPass(const ICFGNode* cycle_head,
761
758
  AbstractState& pre_es)
762
759
  {
763
760
  // increasing iterations
764
- AbstractState new_pre_es = pre_es.widening(_postAbstractTrace[cycle_head]);
761
+ AbstractState new_pre_es = pre_es.widening(_postAbsTrace[cycle_head]);
765
762
  AbstractState new_pre_vaddr_es = new_pre_es;
766
- _svfir2AbsState->widenAddrs(new_pre_es, _postAbstractTrace[cycle_head]);
763
+ //_svfir2AbsState->widenAddrs(getCurState(), new_pre_es, _postAbsTrace[cycle_head]);
767
764
 
768
765
  if (pre_es >= new_pre_es)
769
766
  {
770
767
  // increasing iterations - fixpoint reached
771
768
  pre_es = new_pre_es;
772
- _postAbstractTrace[cycle_head] = pre_es;
769
+ _postAbsTrace[cycle_head] = pre_es;
773
770
  return true;
774
771
  }
775
772
  else
776
773
  {
777
774
  pre_es = new_pre_es;
778
- _postAbstractTrace[cycle_head] = pre_es;
775
+ _postAbsTrace[cycle_head] = pre_es;
779
776
  return false;
780
777
  }
781
778
  }
@@ -783,20 +780,20 @@ bool AbstractInterpretation::widenFixpointPass(const ICFGNode* cycle_head,
783
780
  bool AbstractInterpretation::narrowFixpointPass(const SVF::ICFGNode *cycle_head, SVF::AbstractState&pre_es)
784
781
  {
785
782
  // decreasing iterations
786
- AbstractState new_pre_es = pre_es.narrowing(_postAbstractTrace[cycle_head]);
783
+ AbstractState new_pre_es = pre_es.narrowing(_postAbsTrace[cycle_head]);
787
784
  AbstractState new_pre_vaddr_es = new_pre_es;
788
- _svfir2AbsState->narrowAddrs(new_pre_es, _postAbstractTrace[cycle_head]);
785
+ //_svfir2AbsState->narrowAddrs(getCurState(), new_pre_es, _postAbsTrace[cycle_head]);
789
786
  if (new_pre_es >= pre_es)
790
787
  {
791
788
  // decreasing iterations - fixpoint reached
792
789
  pre_es = new_pre_es;
793
- _postAbstractTrace[cycle_head] = pre_es;
790
+ _postAbsTrace[cycle_head] = pre_es;
794
791
  return true;
795
792
  }
796
793
  else
797
794
  {
798
795
  pre_es = new_pre_es;
799
- _postAbstractTrace[cycle_head] = pre_es;
796
+ _postAbsTrace[cycle_head] = pre_es;
800
797
  return false;
801
798
  }
802
799
  }
@@ -829,17 +826,18 @@ void AbstractInterpretation::handleFunc(const SVFFunction *func)
829
826
 
830
827
  void AbstractInterpretation::handleSVFStatement(const SVFStmt *stmt)
831
828
  {
829
+ AbstractState& as = getAbsState(stmt->getICFGNode());
832
830
  if (const AddrStmt *addr = SVFUtil::dyn_cast<AddrStmt>(stmt))
833
831
  {
834
- _svfir2AbsState->handleAddr(addr);
832
+ _svfir2AbsState->handleAddr(as, addr);
835
833
  }
836
834
  else if (const BinaryOPStmt *binary = SVFUtil::dyn_cast<BinaryOPStmt>(stmt))
837
835
  {
838
- _svfir2AbsState->handleBinary(binary);
836
+ _svfir2AbsState->handleBinary(as, binary);
839
837
  }
840
838
  else if (const CmpStmt *cmp = SVFUtil::dyn_cast<CmpStmt>(stmt))
841
839
  {
842
- _svfir2AbsState->handleCmp(cmp);
840
+ _svfir2AbsState->handleCmp(as, cmp);
843
841
  }
844
842
  else if (SVFUtil::isa<UnaryOPStmt>(stmt))
845
843
  {
@@ -850,36 +848,36 @@ void AbstractInterpretation::handleSVFStatement(const SVFStmt *stmt)
850
848
  }
851
849
  else if (const LoadStmt *load = SVFUtil::dyn_cast<LoadStmt>(stmt))
852
850
  {
853
- _svfir2AbsState->handleLoad(load);
851
+ _svfir2AbsState->handleLoad(as, load);
854
852
  }
855
853
  else if (const StoreStmt *store = SVFUtil::dyn_cast<StoreStmt>(stmt))
856
854
  {
857
- _svfir2AbsState->handleStore(store);
855
+ _svfir2AbsState->handleStore(as, store);
858
856
  }
859
857
  else if (const CopyStmt *copy = SVFUtil::dyn_cast<CopyStmt>(stmt))
860
858
  {
861
- _svfir2AbsState->handleCopy(copy);
859
+ _svfir2AbsState->handleCopy(as, copy);
862
860
  }
863
861
  else if (const GepStmt *gep = SVFUtil::dyn_cast<GepStmt>(stmt))
864
862
  {
865
- _svfir2AbsState->handleGep(gep);
863
+ _svfir2AbsState->handleGep(as, gep);
866
864
  }
867
865
  else if (const SelectStmt *select = SVFUtil::dyn_cast<SelectStmt>(stmt))
868
866
  {
869
- _svfir2AbsState->handleSelect(select);
867
+ _svfir2AbsState->handleSelect(as, select);
870
868
  }
871
869
  else if (const PhiStmt *phi = SVFUtil::dyn_cast<PhiStmt>(stmt))
872
870
  {
873
- _svfir2AbsState->handlePhi(phi);
871
+ _svfir2AbsState->handlePhi(as, phi);
874
872
  }
875
873
  else if (const CallPE *callPE = SVFUtil::dyn_cast<CallPE>(stmt))
876
874
  {
877
875
  // To handle Call Edge
878
- _svfir2AbsState->handleCall(callPE);
876
+ _svfir2AbsState->handleCall(as, callPE);
879
877
  }
880
878
  else if (const RetPE *retPE = SVFUtil::dyn_cast<RetPE>(stmt))
881
879
  {
882
- _svfir2AbsState->handleRet(retPE);
880
+ _svfir2AbsState->handleRet(as, retPE);
883
881
  }
884
882
  else
885
883
  assert(false && "implement this part");
@@ -888,15 +886,16 @@ void AbstractInterpretation::handleSVFStatement(const SVFStmt *stmt)
888
886
 
889
887
  void AbstractInterpretation::SkipRecursiveCall(const CallICFGNode *callNode)
890
888
  {
889
+ AbstractState& as = getAbsState(callNode);
891
890
  const SVFFunction *callfun = SVFUtil::getCallee(callNode->getCallSite());
892
891
  const RetICFGNode *retNode = callNode->getRetICFGNode();
893
892
  if (retNode->getSVFStmts().size() > 0)
894
893
  {
895
894
  if (const RetPE *retPE = SVFUtil::dyn_cast<RetPE>(*retNode->getSVFStmts().begin()))
896
895
  {
897
- AbstractState es;
896
+ AbstractState as;
898
897
  if (!retPE->getLHSVar()->isPointer() && !retPE->getLHSVar()->isConstDataOrAggDataButNotNullPtr())
899
- _svfir2AbsState->getAbsState()[retPE->getLHSVarID()] = IntervalValue::top();
898
+ as[retPE->getLHSVarID()] = IntervalValue::top();
900
899
  }
901
900
  }
902
901
  if (!retNode->getOutEdges().empty())
@@ -910,16 +909,9 @@ void AbstractInterpretation::SkipRecursiveCall(const CallICFGNode *callNode)
910
909
  return;
911
910
  }
912
911
  }
913
- SkipRecursiveFunc(callfun);
914
- }
915
-
916
- void AbstractInterpretation::SkipRecursiveFunc(const SVFFunction *func)
917
- {
918
- // handle Recursive Funcs, go throw every relevant funcs/blocks.
919
- // for every Call Argv, Ret , Global Vars, we make it as Top value
920
912
  FIFOWorkList<const SVFBasicBlock *> blkWorkList;
921
913
  FIFOWorkList<const ICFGNode *> instWorklist;
922
- for (const SVFBasicBlock * bb: func->getReachableBBs())
914
+ for (const SVFBasicBlock * bb: callfun->getReachableBBs())
923
915
  {
924
916
  for (const SVFInstruction* inst: bb->getInstructionList())
925
917
  {
@@ -930,15 +922,14 @@ void AbstractInterpretation::SkipRecursiveFunc(const SVFFunction *func)
930
922
  {
931
923
  const SVFVar *rhsVar = store->getRHSVar();
932
924
  u32_t lhs = store->getLHSVarID();
933
- AbstractState&curES = _svfir2AbsState->getAbsState();
934
- if (curES.inVarToAddrsTable(lhs))
925
+ if (as.inVarToAddrsTable(lhs))
935
926
  {
936
927
  if (!rhsVar->isPointer() && !rhsVar->isConstDataOrAggDataButNotNullPtr())
937
928
  {
938
- const AbstractValue &addrs =curES.getAddrs(lhs);
929
+ const AbstractValue &addrs = as.getAddrs(lhs);
939
930
  for (const auto &addr: addrs.getAddrs())
940
931
  {
941
- curES.store(addr, IntervalValue::top());
932
+ as.store(addr, IntervalValue::top());
942
933
  }
943
934
  }
944
935
  }
@@ -959,10 +950,10 @@ void AEStat::countStateSize()
959
950
  generalNumMap["ES_Loc_Addr_AVG_Num"] = 0;
960
951
  }
961
952
  ++count;
962
- generalNumMap["ES_Var_AVG_Num"] +=
963
- _ae->_svfir2AbsState->getAbsState().getVarToVal().size();
964
- generalNumMap["ES_Loc_AVG_Num"] +=
965
- _ae->_svfir2AbsState->getAbsState().getLocToVal().size();
953
+ // generalNumMap["ES_Var_AVG_Num"] +=
954
+ // _ae->getCurState().getVarToVal().size();
955
+ // generalNumMap["ES_Loc_AVG_Num"] +=
956
+ // _ae->getCurState().getLocToVal().size();
966
957
  }
967
958
 
968
959
  void AEStat::finializeStat()
@@ -1071,14 +1062,15 @@ void AbstractInterpretation::initExtFunMap()
1071
1062
  {
1072
1063
  #define SSE_FUNC_PROCESS(LLVM_NAME ,FUNC_NAME) \
1073
1064
  auto sse_##FUNC_NAME = [this](const CallSite &cs) { \
1074
- /* run real ext function */ \
1075
- AbstractState&es = _svfir2AbsState->getAbsState(); \
1065
+ /* run real ext function */ \
1066
+ const CallICFGNode* callNode = SVFUtil::dyn_cast<CallICFGNode>(_svfir->getICFG()->getICFGNode(cs.getInstruction())); \
1067
+ AbstractState& as = getAbsState(callNode); \
1076
1068
  u32_t rhs_id = _svfir->getValueNode(cs.getArgument(0)); \
1077
- if (!es.inVarToValTable(rhs_id)) return; \
1078
- u32_t rhs = _svfir2AbsState->getAbsState()[rhs_id].getInterval().lb().getIntNumeral(); \
1069
+ if (!as.inVarToValTable(rhs_id)) return; \
1070
+ u32_t rhs = as[rhs_id].getInterval().lb().getIntNumeral(); \
1079
1071
  s32_t res = FUNC_NAME(rhs); \
1080
1072
  u32_t lhsId = _svfir->getValueNode(cs.getInstruction()); \
1081
- _svfir2AbsState->getAbsState()[lhsId] = IntervalValue(res); \
1073
+ as[lhsId] = IntervalValue(res); \
1082
1074
  return; \
1083
1075
  }; \
1084
1076
  _func_map[#FUNC_NAME] = sse_##FUNC_NAME;
@@ -1107,9 +1099,9 @@ void AbstractInterpretation::initExtFunMap()
1107
1099
  const CallICFGNode* callNode = SVFUtil::dyn_cast<CallICFGNode>(_svfir->getICFG()->getICFGNode(cs.getInstruction()));
1108
1100
  _checkpoints.erase(callNode);
1109
1101
  u32_t arg0 = _svfir->getValueNode(cs.getArgument(0));
1110
- AbstractState&es = _svfir2AbsState->getAbsState();
1111
- es[arg0].getInterval().meet_with(IntervalValue(1, 1));
1112
- if (es[arg0].getInterval().equals(IntervalValue(1, 1)))
1102
+ AbstractState&as = getAbsState(callNode);
1103
+ as[arg0].getInterval().meet_with(IntervalValue(1, 1));
1104
+ if (as[arg0].getInterval().equals(IntervalValue(1, 1)))
1113
1105
  {
1114
1106
  SVFUtil::outs() << SVFUtil::sucMsg("The assertion is successfully verified!!\n");
1115
1107
  }
@@ -1125,11 +1117,12 @@ void AbstractInterpretation::initExtFunMap()
1125
1117
  auto svf_print = [&](const CallSite &cs)
1126
1118
  {
1127
1119
  if (cs.arg_size() < 2) return;
1128
- AbstractState&es = _svfir2AbsState->getAbsState();
1120
+ const CallICFGNode* callNode = SVFUtil::dyn_cast<CallICFGNode>(_svfir->getICFG()->getICFGNode(cs.getInstruction()));
1121
+ AbstractState&as = getAbsState(callNode);
1129
1122
  u32_t num_id = _svfir->getValueNode(cs.getArgument(0));
1130
- std::string text = strRead(cs.getArgument(1));
1131
- assert(es.inVarToValTable(num_id) && "print() should pass integer");
1132
- IntervalValue itv = es[num_id].getInterval();
1123
+ std::string text = strRead(as, cs.getArgument(1));
1124
+ assert(as.inVarToValTable(num_id) && "print() should pass integer");
1125
+ IntervalValue itv = as[num_id].getInterval();
1133
1126
  std::cout << "Text: " << text <<", Value: " << cs.getArgument(0)->toString() << ", PrintVal: " << itv.toString() << std::endl;
1134
1127
  return;
1135
1128
  };
@@ -1139,22 +1132,21 @@ void AbstractInterpretation::initExtFunMap()
1139
1132
  _checkpoint_names.insert("svf_assert");
1140
1133
  };
1141
1134
 
1142
- std::string AbstractInterpretation::strRead(const SVFValue* rhs)
1135
+ std::string AbstractInterpretation::strRead(AbstractState& as, const SVFValue* rhs)
1143
1136
  {
1144
1137
  // sse read string nodeID->string
1145
- AbstractState&es = _svfir2AbsState->getAbsState();
1146
1138
  std::string str0;
1147
1139
 
1148
1140
  for (u32_t index = 0; index < Options::MaxFieldLimit(); index++)
1149
1141
  {
1150
1142
  // dead loop for string and break if there's a \0. If no \0, it will throw err.
1151
- if (!es.inVarToAddrsTable(_svfir->getValueNode(rhs))) continue;
1143
+ if (!as.inVarToAddrsTable(_svfir->getValueNode(rhs))) continue;
1152
1144
  AbstractValue expr0 =
1153
- _svfir2AbsState->getGepObjAddress(_svfir->getValueNode(rhs), index);
1145
+ _svfir2AbsState->getGepObjAddress(as, _svfir->getValueNode(rhs), index);
1154
1146
  AbstractValue val(AbstractValue::UnknownType);
1155
1147
  for (const auto &addr: expr0.getAddrs())
1156
1148
  {
1157
- val.join_with(es.load(addr));
1149
+ val.join_with(as.load(addr));
1158
1150
  }
1159
1151
  if (val.isUnknown())
1160
1152
  return str0;
@@ -1173,6 +1165,7 @@ std::string AbstractInterpretation::strRead(const SVFValue* rhs)
1173
1165
 
1174
1166
  void AbstractInterpretation::handleExtAPI(const CallICFGNode *call)
1175
1167
  {
1168
+ AbstractState& as = getAbsState(call);
1176
1169
  const SVFFunction *fun = SVFUtil::getCallee(call->getCallSite());
1177
1170
  assert(fun && "SVFFunction* is nullptr");
1178
1171
  CallSite cs = SVFUtil::getSVFCallSite(call->getCallSite());
@@ -1198,13 +1191,13 @@ void AbstractInterpretation::handleExtAPI(const CallICFGNode *call)
1198
1191
  else
1199
1192
  {
1200
1193
  u32_t lhsId = _svfir->getValueNode(SVFUtil::getSVFCallSite(call->getCallSite()).getInstruction());
1201
- if (_svfir2AbsState->getAbsState().inVarToAddrsTable(lhsId))
1194
+ if (as.inVarToAddrsTable(lhsId))
1202
1195
  {
1203
1196
 
1204
1197
  }
1205
1198
  else
1206
1199
  {
1207
- _svfir2AbsState->getAbsState()[lhsId] = IntervalValue();
1200
+ as[lhsId] = IntervalValue();
1208
1201
  }
1209
1202
  return;
1210
1203
  }
@@ -1212,21 +1205,15 @@ void AbstractInterpretation::handleExtAPI(const CallICFGNode *call)
1212
1205
  // 1. memcpy functions like memcpy_chk, strncpy, annotate("MEMCPY"), annotate("BUF_CHECK:Arg0, Arg2"), annotate("BUF_CHECK:Arg1, Arg2")
1213
1206
  else if (extType == MEMCPY)
1214
1207
  {
1215
- AbstractValue len =
1216
- _svfir2AbsState
1217
- ->getAbsState()[_svfir->getValueNode(cs.getArgument(2))];
1218
- handleMemcpy(cs.getArgument(0), cs.getArgument(1), len, 0);
1208
+ AbstractValue len = as[_svfir->getValueNode(cs.getArgument(2))];
1209
+ handleMemcpy(as, cs.getArgument(0), cs.getArgument(1), len, 0);
1219
1210
  }
1220
1211
  else if (extType == MEMSET)
1221
1212
  {
1222
1213
  // memset dst is arg0, elem is arg1, size is arg2
1223
- AbstractValue len =
1224
- _svfir2AbsState
1225
- ->getAbsState()[_svfir->getValueNode(cs.getArgument(2))];
1226
- AbstractValue elem =
1227
- _svfir2AbsState
1228
- ->getAbsState()[_svfir->getValueNode(cs.getArgument(1))];
1229
- handleMemset(cs.getArgument(0), elem, len);
1214
+ AbstractValue len = as[_svfir->getValueNode(cs.getArgument(2))];
1215
+ AbstractValue elem = as[_svfir->getValueNode(cs.getArgument(1))];
1216
+ handleMemset(as,cs.getArgument(0), elem, len);
1230
1217
  }
1231
1218
  else if (extType == STRCPY)
1232
1219
  {
@@ -1285,15 +1272,16 @@ void AbstractInterpretation::handleStrcpy(const CallICFGNode *call)
1285
1272
  {
1286
1273
  // strcpy, __strcpy_chk, stpcpy , wcscpy, __wcscpy_chk
1287
1274
  // get the dst and src
1275
+ AbstractState& as = getAbsState(call);
1288
1276
  CallSite cs = SVFUtil::getSVFCallSite(call->getCallSite());
1289
1277
  const SVFValue* arg0Val = cs.getArgument(0);
1290
1278
  const SVFValue* arg1Val = cs.getArgument(1);
1291
- AbstractValue strLen = getStrlen(arg1Val);
1279
+ AbstractValue strLen = getStrlen(as, arg1Val);
1292
1280
  // no need to -1, since it has \0 as the last byte
1293
- handleMemcpy(arg0Val, arg1Val, strLen,strLen.lb().getIntNumeral());
1281
+ handleMemcpy(as, arg0Val, arg1Val, strLen,strLen.lb().getIntNumeral());
1294
1282
  }
1295
1283
 
1296
- u32_t AbstractInterpretation::getAllocaInstByteSize(const AddrStmt *addr)
1284
+ u32_t AbstractInterpretation::getAllocaInstByteSize(AbstractState& as, const AddrStmt *addr)
1297
1285
  {
1298
1286
  if (const ObjVar* objvar = SVFUtil::dyn_cast<ObjVar>(addr->getRHSVar()))
1299
1287
  {
@@ -1312,13 +1300,12 @@ u32_t AbstractInterpretation::getAllocaInstByteSize(const AddrStmt *addr)
1312
1300
  u64_t res = elementSize;
1313
1301
  for (const SVFValue* value: sizes)
1314
1302
  {
1315
- if (!_svfir2AbsState->inVarToValTable(_svfir->getValueNode(value)))
1303
+ if (!_svfir2AbsState->inVarToValTable(as, _svfir->getValueNode(value)))
1316
1304
  {
1317
- _svfir2AbsState
1318
- ->getAbsState()[_svfir->getValueNode(value)] = IntervalValue(Options::MaxFieldLimit());
1305
+ as[_svfir->getValueNode(value)] = IntervalValue(Options::MaxFieldLimit());
1319
1306
  }
1320
1307
  AbstractValue itv =
1321
- _svfir2AbsState->getAbsState()[_svfir->getValueNode(value)];
1308
+ as[_svfir->getValueNode(value)];
1322
1309
  res = res * itv.ub().getIntNumeral() > Options::MaxFieldLimit()? Options::MaxFieldLimit(): res * itv.ub().getIntNumeral();
1323
1310
  }
1324
1311
  return (u32_t)res;
@@ -1328,7 +1315,7 @@ u32_t AbstractInterpretation::getAllocaInstByteSize(const AddrStmt *addr)
1328
1315
  abort();
1329
1316
  }
1330
1317
 
1331
- AbstractValue AbstractInterpretation::traceMemoryAllocationSize(const SVFValue *value)
1318
+ AbstractValue AbstractInterpretation::traceMemoryAllocationSize(AbstractState& as, const SVFValue *value)
1332
1319
  {
1333
1320
  /// Usually called by a GepStmt overflow check, or external API (like memcpy) overflow check
1334
1321
  /// Defitions of Terms:
@@ -1363,7 +1350,7 @@ AbstractValue AbstractInterpretation::traceMemoryAllocationSize(const SVFValue *
1363
1350
  else if (const LoadStmt *load = SVFUtil::dyn_cast<LoadStmt>(stmt))
1364
1351
  {
1365
1352
  // Load Stmt, forward to the Var from last Store Stmt
1366
- AccessMemoryViaLoadStmt(load, worklist, visited);
1353
+ AccessMemoryViaLoadStmt(as, load, worklist, visited);
1367
1354
  }
1368
1355
  else if (const GepStmt *gep = SVFUtil::dyn_cast<GepStmt>(stmt))
1369
1356
  {
@@ -1410,7 +1397,7 @@ AbstractValue AbstractInterpretation::traceMemoryAllocationSize(const SVFValue *
1410
1397
  else
1411
1398
  {
1412
1399
  IntervalValue byteOffset =
1413
- _svfir2AbsState->getByteOffset(gep).getInterval();
1400
+ _svfir2AbsState->getByteOffset(as, gep).getInterval();
1414
1401
  }
1415
1402
  // for variable offset, join with accumulate gep offset
1416
1403
  gep_offsets[gep->getICFGNode()] = byteOffset;
@@ -1426,7 +1413,7 @@ AbstractValue AbstractInterpretation::traceMemoryAllocationSize(const SVFValue *
1426
1413
  else if (const AddrStmt *addr = SVFUtil::dyn_cast<AddrStmt>(stmt))
1427
1414
  {
1428
1415
  // addrStmt is source node.
1429
- u32_t arr_type_size = getAllocaInstByteSize(addr);
1416
+ u32_t arr_type_size = getAllocaInstByteSize(as, addr);
1430
1417
  return IntervalValue(arr_type_size) - total_bytes;
1431
1418
  }
1432
1419
  }
@@ -1437,7 +1424,7 @@ AbstractValue AbstractInterpretation::traceMemoryAllocationSize(const SVFValue *
1437
1424
  const SVFType* svftype = gvalue->getType();
1438
1425
  if (SVFUtil::isa<SVFPointerType>(svftype))
1439
1426
  {
1440
- if(const SVFArrayType* ptrArrType = SVFUtil::dyn_cast<SVFArrayType>(getPointeeElement(_svfir->getValueNode(value))))
1427
+ if(const SVFArrayType* ptrArrType = SVFUtil::dyn_cast<SVFArrayType>(getPointeeElement(as, _svfir->getValueNode(value))))
1441
1428
  arr_type_size = ptrArrType->getByteSize();
1442
1429
  else
1443
1430
  arr_type_size = svftype->getByteSize();
@@ -1461,23 +1448,22 @@ AbstractValue AbstractInterpretation::traceMemoryAllocationSize(const SVFValue *
1461
1448
  }
1462
1449
 
1463
1450
 
1464
- AbstractValue AbstractInterpretation::getStrlen(const SVF::SVFValue *strValue)
1451
+ AbstractValue AbstractInterpretation::getStrlen(AbstractState& as, const SVF::SVFValue *strValue)
1465
1452
  {
1466
- AbstractState&es = _svfir2AbsState->getAbsState();
1467
- AbstractValue dst_size = traceMemoryAllocationSize(strValue);
1453
+ AbstractValue dst_size = traceMemoryAllocationSize(as, strValue);
1468
1454
  u32_t len = 0;
1469
1455
  NodeID dstid = _svfir->getValueNode(strValue);
1470
1456
  u32_t elemSize = 1;
1471
- if (_svfir2AbsState->inVarToAddrsTable(dstid))
1457
+ if (_svfir2AbsState->inVarToAddrsTable(as, dstid))
1472
1458
  {
1473
1459
  for (u32_t index = 0; index < dst_size.lb().getIntNumeral(); index++)
1474
1460
  {
1475
1461
  AbstractValue expr0 =
1476
- _svfir2AbsState->getGepObjAddress(dstid, index);
1462
+ _svfir2AbsState->getGepObjAddress(as, dstid, index);
1477
1463
  AbstractValue val(AbstractValue::UnknownType);
1478
1464
  for (const auto &addr: expr0.getAddrs())
1479
1465
  {
1480
- val.join_with(es.load(addr));
1466
+ val.join_with(as.load(addr));
1481
1467
  }
1482
1468
  if (val.isUnknown())
1483
1469
  {
@@ -1495,7 +1481,7 @@ AbstractValue AbstractInterpretation::getStrlen(const SVF::SVFValue *strValue)
1495
1481
  }
1496
1482
  else if (strValue->getType()->isPointerTy())
1497
1483
  {
1498
- if (const SVFType* elemType = getPointeeElement(_svfir->getValueNode(strValue)))
1484
+ if (const SVFType* elemType = getPointeeElement(as, _svfir->getValueNode(strValue)))
1499
1485
  {
1500
1486
  elemSize = elemType->getByteSize();
1501
1487
  }
@@ -1524,6 +1510,7 @@ void AbstractInterpretation::handleStrcat(const SVF::CallICFGNode *call)
1524
1510
  {
1525
1511
  // __strcat_chk, strcat, __wcscat_chk, wcscat, __strncat_chk, strncat, __wcsncat_chk, wcsncat
1526
1512
  // to check it is strcat group or strncat group
1513
+ AbstractState& as = getAbsState(call);
1527
1514
  const SVFFunction *fun = SVFUtil::getCallee(call->getCallSite());
1528
1515
  const std::vector<std::string> strcatGroup = {"__strcat_chk", "strcat", "__wcscat_chk", "wcscat"};
1529
1516
  const std::vector<std::string> strncatGroup = {"__strncat_chk", "strncat", "__wcsncat_chk", "wcsncat"};
@@ -1532,10 +1519,10 @@ void AbstractInterpretation::handleStrcat(const SVF::CallICFGNode *call)
1532
1519
  CallSite cs = SVFUtil::getSVFCallSite(call->getCallSite());
1533
1520
  const SVFValue* arg0Val = cs.getArgument(0);
1534
1521
  const SVFValue* arg1Val = cs.getArgument(1);
1535
- AbstractValue strLen0 = getStrlen(arg0Val);
1536
- AbstractValue strLen1 = getStrlen(arg1Val);
1522
+ AbstractValue strLen0 = getStrlen(as, arg0Val);
1523
+ AbstractValue strLen1 = getStrlen(as, arg1Val);
1537
1524
  AbstractValue totalLen = strLen0 + strLen1;
1538
- handleMemcpy(arg0Val, arg1Val, strLen1, strLen0.lb().getIntNumeral());
1525
+ handleMemcpy(as, arg0Val, arg1Val, strLen1, strLen0.lb().getIntNumeral());
1539
1526
  // do memcpy
1540
1527
  }
1541
1528
  else if (std::find(strncatGroup.begin(), strncatGroup.end(), fun->getName()) != strncatGroup.end())
@@ -1544,11 +1531,10 @@ void AbstractInterpretation::handleStrcat(const SVF::CallICFGNode *call)
1544
1531
  const SVFValue* arg0Val = cs.getArgument(0);
1545
1532
  const SVFValue* arg1Val = cs.getArgument(1);
1546
1533
  const SVFValue* arg2Val = cs.getArgument(2);
1547
- AbstractValue arg2Num =
1548
- _svfir2AbsState->getAbsState()[_svfir->getValueNode(arg2Val)];
1549
- AbstractValue strLen0 = getStrlen(arg0Val);
1534
+ AbstractValue arg2Num = as[_svfir->getValueNode(arg2Val)];
1535
+ AbstractValue strLen0 = getStrlen(as, arg0Val);
1550
1536
  AbstractValue totalLen = strLen0 + arg2Num;
1551
- handleMemcpy(arg0Val, arg1Val, arg2Num, strLen0.lb().getIntNumeral());
1537
+ handleMemcpy(as, arg0Val, arg1Val, arg2Num, strLen0.lb().getIntNumeral());
1552
1538
  // do memcpy
1553
1539
  }
1554
1540
  else
@@ -1557,9 +1543,8 @@ void AbstractInterpretation::handleStrcat(const SVF::CallICFGNode *call)
1557
1543
  }
1558
1544
  }
1559
1545
 
1560
- void AbstractInterpretation::handleMemcpy(const SVF::SVFValue *dst, const SVF::SVFValue *src, AbstractValue len, u32_t start_idx)
1546
+ void AbstractInterpretation::handleMemcpy(AbstractState& as, const SVF::SVFValue *dst, const SVF::SVFValue *src, AbstractValue len, u32_t start_idx)
1561
1547
  {
1562
- AbstractState&es = _svfir2AbsState->getAbsState();
1563
1548
  u32_t dstId = _svfir->getValueNode(dst); // pts(dstId) = {objid} objbar objtypeinfo->getType().
1564
1549
  u32_t srcId = _svfir->getValueNode(src);
1565
1550
  u32_t elemSize = 1;
@@ -1570,7 +1555,7 @@ void AbstractInterpretation::handleMemcpy(const SVF::SVFValue *dst, const SVF::S
1570
1555
  // memcpy(i32*, i32*, 40)
1571
1556
  else if (dst->getType()->isPointerTy())
1572
1557
  {
1573
- if (const SVFType* elemType = getPointeeElement(_svfir->getValueNode(dst)))
1558
+ if (const SVFType* elemType = getPointeeElement(as, _svfir->getValueNode(dst)))
1574
1559
  {
1575
1560
  if (elemType->isArrayTy())
1576
1561
  elemSize = SVFUtil::dyn_cast<SVFArrayType>(elemType)->getTypeOfElement()->getByteSize();
@@ -1588,28 +1573,28 @@ void AbstractInterpretation::handleMemcpy(const SVF::SVFValue *dst, const SVF::S
1588
1573
  }
1589
1574
  u32_t size = std::min((u32_t)Options::MaxFieldLimit(), (u32_t) len.lb().getIntNumeral());
1590
1575
  u32_t range_val = size / elemSize;
1591
- if (_svfir2AbsState->inVarToAddrsTable(srcId) &&
1592
- _svfir2AbsState->inVarToAddrsTable(dstId))
1576
+ if (_svfir2AbsState->inVarToAddrsTable(as, srcId) &&
1577
+ _svfir2AbsState->inVarToAddrsTable(as, dstId))
1593
1578
  {
1594
1579
  for (u32_t index = 0; index < range_val; index++)
1595
1580
  {
1596
1581
  // dead loop for string and break if there's a \0. If no \0, it will throw err.
1597
1582
  AbstractValue expr_src =
1598
- _svfir2AbsState->getGepObjAddress(srcId, index);
1583
+ _svfir2AbsState->getGepObjAddress(as, srcId, index);
1599
1584
  AbstractValue expr_dst =
1600
- _svfir2AbsState->getGepObjAddress(dstId, index + start_idx);
1585
+ _svfir2AbsState->getGepObjAddress(as, dstId, index + start_idx);
1601
1586
  for (const auto &dst: expr_dst.getAddrs())
1602
1587
  {
1603
1588
  for (const auto &src: expr_src.getAddrs())
1604
1589
  {
1605
1590
  u32_t objId = AbstractState::getInternalID(src);
1606
- if (es.inLocToValTable(objId))
1591
+ if (as.inLocToValTable(objId))
1607
1592
  {
1608
- es.store(dst, es.load(src));
1593
+ as.store(dst, as.load(src));
1609
1594
  }
1610
- else if (es.inLocToAddrsTable(objId))
1595
+ else if (as.inLocToAddrsTable(objId))
1611
1596
  {
1612
- es.store(dst, es.load(src));
1597
+ as.store(dst, as.load(src));
1613
1598
  }
1614
1599
  }
1615
1600
  }
@@ -1617,14 +1602,14 @@ void AbstractInterpretation::handleMemcpy(const SVF::SVFValue *dst, const SVF::S
1617
1602
  }
1618
1603
  }
1619
1604
 
1620
- const SVFType* AbstractInterpretation::getPointeeElement(NodeID id)
1605
+ const SVFType* AbstractInterpretation::getPointeeElement(AbstractState& as, NodeID id)
1621
1606
  {
1622
- if (_svfir2AbsState->inVarToAddrsTable(id))
1607
+ if (_svfir2AbsState->inVarToAddrsTable(as, id))
1623
1608
  {
1624
- const AbstractValue& addrs = _svfir2AbsState->getAddrs(id);
1609
+ const AbstractValue& addrs = _svfir2AbsState->getAddrs(as, id);
1625
1610
  for (auto addr: addrs.getAddrs())
1626
1611
  {
1627
- NodeID addr_id = _svfir2AbsState->getInternalID(addr);
1612
+ NodeID addr_id = AbstractState::getInternalID(addr);
1628
1613
  if (addr_id == 0) // nullptr has no memobj, skip
1629
1614
  continue;
1630
1615
  return SVFUtil::dyn_cast<ObjVar>(_svfir->getGNode(addr_id))->getMemObj()->getType();
@@ -1637,9 +1622,8 @@ const SVFType* AbstractInterpretation::getPointeeElement(NodeID id)
1637
1622
  return nullptr;
1638
1623
  }
1639
1624
 
1640
- void AbstractInterpretation::handleMemset(const SVF::SVFValue *dst, AbstractValue elem, AbstractValue len)
1625
+ void AbstractInterpretation::handleMemset(AbstractState& as, const SVF::SVFValue *dst, AbstractValue elem, AbstractValue len)
1641
1626
  {
1642
- AbstractState&es = _svfir2AbsState->getAbsState();
1643
1627
  u32_t dstId = _svfir->getValueNode(dst);
1644
1628
  u32_t size = std::min((u32_t)Options::MaxFieldLimit(), (u32_t) len.lb().getIntNumeral());
1645
1629
  u32_t elemSize = 1;
@@ -1649,7 +1633,7 @@ void AbstractInterpretation::handleMemset(const SVF::SVFValue *dst, AbstractValu
1649
1633
  }
1650
1634
  else if (dst->getType()->isPointerTy())
1651
1635
  {
1652
- if (const SVFType* elemType = getPointeeElement(_svfir->getValueNode(dst)))
1636
+ if (const SVFType* elemType = getPointeeElement(as, _svfir->getValueNode(dst)))
1653
1637
  {
1654
1638
  elemSize = elemType->getByteSize();
1655
1639
  }
@@ -1667,22 +1651,22 @@ void AbstractInterpretation::handleMemset(const SVF::SVFValue *dst, AbstractValu
1667
1651
  for (u32_t index = 0; index < range_val; index++)
1668
1652
  {
1669
1653
  // dead loop for string and break if there's a \0. If no \0, it will throw err.
1670
- if (_svfir2AbsState->inVarToAddrsTable(dstId))
1654
+ if (_svfir2AbsState->inVarToAddrsTable(as, dstId))
1671
1655
  {
1672
1656
  AbstractValue lhs_gep =
1673
- _svfir2AbsState->getGepObjAddress(dstId, index);
1657
+ _svfir2AbsState->getGepObjAddress(as, dstId, index);
1674
1658
  for (const auto &addr: lhs_gep.getAddrs())
1675
1659
  {
1676
1660
  u32_t objId = AbstractState::getInternalID(addr);
1677
- if (es.inLocToValTable(objId))
1661
+ if (as.inLocToValTable(objId))
1678
1662
  {
1679
- AbstractValue tmp = es.load(addr);
1663
+ AbstractValue tmp = as.load(addr);
1680
1664
  tmp.join_with(elem);
1681
- es.store(addr, tmp);
1665
+ as.store(addr, tmp);
1682
1666
  }
1683
1667
  else
1684
1668
  {
1685
- es.store(addr, elem);
1669
+ as.store(addr, elem);
1686
1670
  }
1687
1671
  }
1688
1672
  }
@@ -1727,15 +1711,15 @@ void AbstractInterpretation::AccessMemoryViaCopyStmt(const CopyStmt *copy, SVF::
1727
1711
  }
1728
1712
  }
1729
1713
 
1730
- void AbstractInterpretation::AccessMemoryViaLoadStmt(const LoadStmt *load, SVF::FILOWorkList<const SVFValue *>& worklist, Set<const SVFValue *>& visited)
1714
+ void AbstractInterpretation::AccessMemoryViaLoadStmt(AbstractState& as, const LoadStmt *load, SVF::FILOWorkList<const SVFValue *>& worklist, Set<const SVFValue *>& visited)
1731
1715
  {
1732
- if (_svfir2AbsState->inVarToAddrsTable(load->getLHSVarID()))
1716
+ if (_svfir2AbsState->inVarToAddrsTable(as, load->getLHSVarID()))
1733
1717
  {
1734
1718
  const AbstractValue &Addrs =
1735
- _svfir2AbsState->getAddrs(load->getLHSVarID());
1719
+ _svfir2AbsState->getAddrs(as, load->getLHSVarID());
1736
1720
  for (auto vaddr: Addrs.getAddrs())
1737
1721
  {
1738
- NodeID id = _svfir2AbsState->getInternalID(vaddr);
1722
+ NodeID id = AbstractState::getInternalID(vaddr);
1739
1723
  if (id == 0) // nullptr has no memobj, skip
1740
1724
  continue;
1741
1725
  const auto *val = _svfir->getGNode(id);