svf-tools 1.0.558 → 1.0.559

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 (35) hide show
  1. package/SVF-doxygen/html/html/ExtAPI_8cpp_source.html +5 -2
  2. package/SVF-doxygen/html/html/ExtAPI_8h_source.html +3 -2
  3. package/SVF-doxygen/html/html/SVFUtil_8h_source.html +1 -1
  4. package/SVF-doxygen/html/html/classSVF_1_1ExtAPI-members.html +5 -4
  5. package/SVF-doxygen/html/html/classSVF_1_1ExtAPI.html +40 -5
  6. package/SVF-doxygen/html/html/functions_f.html +3 -3
  7. package/SVF-doxygen/html/html/functions_func_i.html +11 -8
  8. package/SVF-doxygen/html/html/functions_func_s.html +1 -1
  9. package/SVF-doxygen/html/html/functions_i.html +8 -5
  10. package/SVF-doxygen/html/html/functions_l.html +8 -8
  11. package/SVF-doxygen/html/html/functions_o.html +3 -3
  12. package/SVF-doxygen/html/html/functions_p.html +8 -8
  13. package/SVF-doxygen/html/html/functions_s.html +5 -5
  14. package/SVF-doxygen/html/html/functions_t.html +3 -3
  15. package/SVF-doxygen/html/html/functions_v.html +3 -3
  16. package/SVF-doxygen/html/html/functions_w.html +11 -11
  17. package/SVF-doxygen/html/html/search/all_10.js +7 -7
  18. package/SVF-doxygen/html/html/search/all_11.js +1 -1
  19. package/SVF-doxygen/html/html/search/all_12.js +8 -8
  20. package/SVF-doxygen/html/html/search/all_13.js +3 -3
  21. package/SVF-doxygen/html/html/search/all_14.js +1 -1
  22. package/SVF-doxygen/html/html/search/all_15.js +3 -3
  23. package/SVF-doxygen/html/html/search/all_16.js +2 -2
  24. package/SVF-doxygen/html/html/search/all_6.js +1 -1
  25. package/SVF-doxygen/html/html/search/all_9.js +1 -0
  26. package/SVF-doxygen/html/html/search/all_c.js +4 -4
  27. package/SVF-doxygen/html/html/search/all_f.js +1 -1
  28. package/SVF-doxygen/html/html/search/functions_11.js +1 -1
  29. package/SVF-doxygen/html/html/search/functions_8.js +1 -0
  30. package/SVF-doxygen/html/html/search/variables_13.js +1 -1
  31. package/SVF-doxygen/html/html/search/variables_14.js +1 -1
  32. package/include/Util/ExtAPI.h +3 -0
  33. package/include/Util/ExtAPI.json +1456 -44
  34. package/lib/Util/ExtAPI.cpp +42 -4
  35. package/package.json +1 -1
@@ -307,7 +307,7 @@ std::vector<ExtAPI::Operation> ExtAPI::getAllOperations(std::string funName)
307
307
  {
308
308
  cJSON *obj = item->child;
309
309
  // Get the first operation of the function
310
- obj = obj -> next -> next;
310
+ obj = obj -> next -> next -> next -> next;
311
311
  std::vector<ExtAPI::Operation *> operations;
312
312
  while (obj)
313
313
  {
@@ -358,7 +358,7 @@ ExtAPI::extType ExtAPI::get_type(const std::string& funName)
358
358
  if (item != nullptr)
359
359
  {
360
360
  // Get the first operation of the function
361
- cJSON *obj = item->child;
361
+ cJSON *obj = item->child->next->next;
362
362
  if (strcmp(obj->string, JSON_OPT_FUNCTIONTYPE) == 0)
363
363
  type = obj->valuestring;
364
364
  else
@@ -387,7 +387,7 @@ u32_t ExtAPI::isOverwrittenAppFunction(const SVF::SVFFunction *callee)
387
387
  if (item != nullptr)
388
388
  {
389
389
  cJSON *obj = item->child;
390
- obj = obj->next;
390
+ obj = obj->next->next->next;
391
391
  if (strcmp(obj->string, JSON_OPT_OVERWRITE) == 0)
392
392
  return obj->valueint;
393
393
  else
@@ -473,6 +473,42 @@ bool ExtAPI::is_realloc(const SVFFunction *F)
473
473
  return t == EFT_REALLOC;
474
474
  }
475
475
 
476
+ // Does (F) have the same return type(pointer or nonpointer) and same number of arguments
477
+ bool ExtAPI::is_sameSignature(const SVFFunction *F)
478
+ {
479
+ cJSON *item = get_FunJson(F->getName());
480
+ // If return type is pointer
481
+ bool isPointer = false;
482
+ // The number of arguments
483
+ u32_t argNum = 0;
484
+ if (item != nullptr)
485
+ {
486
+ // Get the "return" attribute
487
+ cJSON *obj = item->child;
488
+ if (strlen(obj->valuestring) == 0) // e.g. "return": ""
489
+ assert(false && "'return' should not be empty!");
490
+ // If "return": "..." includes "*", the return type of extern function is a pointer
491
+ if (strstr(obj->valuestring, "*") != NULL)
492
+ isPointer = true;
493
+ // Get the "arguments" attribute
494
+ obj = obj -> next;
495
+ if (strlen(obj->valuestring) == 0) // e.g. "arguments": "",
496
+ assert(false && "'arguments' should not be empty!");
497
+ // If "arguments": "()", the number of arguments is 0, otherwise, number >= 1;
498
+ if (strcmp(obj->valuestring, "()") != 0)
499
+ {
500
+ argNum++;
501
+ for (u32_t i = 0; i < strlen(obj->valuestring); i++)
502
+ if (obj->valuestring[i] == ',') // Calculate the number of arguments based on the number of ","
503
+ argNum++;
504
+ }
505
+ }
506
+ if (F->arg_size() != argNum) // The number of arguments is different
507
+ return false;
508
+ // Is the return type the same?
509
+ return F->getLLVMFun()->getReturnType()->isPointerTy() == isPointer;
510
+ }
511
+
476
512
  // Should (F) be considered "external" (either not defined in the program
477
513
  // or a user-defined version of a known alloc or no-op)?
478
514
  bool ExtAPI::is_ext(const SVFFunction *F)
@@ -489,9 +525,11 @@ bool ExtAPI::is_ext(const SVFFunction *F)
489
525
  if (t != EFT_NULL)
490
526
  {
491
527
  u32_t overwrittenAppFunction = isOverwrittenAppFunction(F);
528
+ if (!is_sameSignature(F))
529
+ res = 0;
492
530
  // overwrittenAppFunction = 1: Execute function specification in ExtAPI.json
493
531
  // F is considered as external function
494
- if (overwrittenAppFunction == 1)
532
+ else if (overwrittenAppFunction == 1)
495
533
  res = 1;
496
534
  // overwrittenAppFunction = 0: Execute user-defined functions
497
535
  // F is not considered as external function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.558",
3
+ "version": "1.0.559",
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": {