[biabduction] Fix lookup of abduced expression

Summary: Currently when we look for already abduced expression and find an assertion [exp|->strexp:typexp], we use typexp rather than strexp.

Reviewed By: sblackshear

Differential Revision: D7617193

fbshipit-source-id: c089720
master
Daiva Naudziuniene 7 years ago committed by Facebook Github Bot
parent 76300d55c7
commit 94aae8713e

@ -885,7 +885,7 @@ let add_constraints_on_retval tenv pdesc prop ret_exp ~has_nonnull_annot typ cal
List.find_map List.find_map
~f:(fun hpred -> ~f:(fun hpred ->
match hpred with match hpred with
| Sil.Hpointsto (Exp.Lvar pv, _, exp) when Pvar.equal pv abduced_ret_pv -> | Sil.Hpointsto (Exp.Lvar pv, Sil.Eexp (exp, _), _) when Pvar.equal pv abduced_ret_pv ->
Some exp Some exp
| _ -> | _ ->
None ) None )

@ -1,3 +1,3 @@
codetoanalyze/cpp/conflicts/test.cpp, test1_bad, 2, NULL_DEREFERENCE, ERROR, [start of procedure test1_bad(),Skipping nullableMethod(): function or method not found] codetoanalyze/cpp/conflicts/test.cpp, test1_bad, 2, NULL_DEREFERENCE, ERROR, [start of procedure test1_bad(),Skipping nullableMethod(): function or method not found]
codetoanalyze/cpp/conflicts/test.cpp, test2_bad, 1, NULLABLE_DEREFERENCE, ERROR, [dereferencing the return of nullableMethod(),definition of nullableMethod] codetoanalyze/cpp/conflicts/test.cpp, test2_bad, 1, NULLABLE_DEREFERENCE, ERROR, [dereferencing the return of nullableMethod(),definition of nullableMethod]
codetoanalyze/cpp/conflicts/test.cpp, test3_bad, 5, NULLABLE_DEREFERENCE, ERROR, [dereference of p,assignment of the nullable value,definition of nullableMethod] codetoanalyze/cpp/conflicts/test.cpp, test3_bad, 5, NULL_DEREFERENCE, ERROR, [start of procedure test3_bad(),Skipping nullableMethod(): function or method not found,Condition is true,Skipping nullableMethod(): function or method not found,Condition is false]

@ -30,5 +30,5 @@ int test3_bad() {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
p = nullableMethod(); p = nullableMethod();
} }
return p->get(); // not reported by the biabduction analysis return p->get(); // reported by the biabduction analysis
} }

@ -198,8 +198,8 @@ codetoanalyze/cpp/errors/types/typeid_expr.cpp, template_type_id_person, 2, MEMO
codetoanalyze/cpp/errors/types/typeid_expr.cpp, template_type_id_person, 5, DIVIDE_BY_ZERO, ERROR, [start of procedure template_type_id_person(),start of procedure Person,return from a call to Person_Person,Condition is false] codetoanalyze/cpp/errors/types/typeid_expr.cpp, template_type_id_person, 5, DIVIDE_BY_ZERO, ERROR, [start of procedure template_type_id_person(),start of procedure Person,return from a call to Person_Person,Condition is false]
codetoanalyze/cpp/errors/types/typeid_expr.cpp, template_typeid<Person>, 2, MEMORY_LEAK, ERROR, [start of procedure template_typeid<Person>(),start of procedure Person,return from a call to Person_Person,start of procedure Person,return from a call to Person_Person,start of procedure ~Person,start of procedure __infer_inner_destructor_~Person,return from a call to Person___infer_inner_destructor_~Person,return from a call to Person_~Person] codetoanalyze/cpp/errors/types/typeid_expr.cpp, template_typeid<Person>, 2, MEMORY_LEAK, ERROR, [start of procedure template_typeid<Person>(),start of procedure Person,return from a call to Person_Person,start of procedure Person,return from a call to Person_Person,start of procedure ~Person,start of procedure __infer_inner_destructor_~Person,return from a call to Person___infer_inner_destructor_~Person,return from a call to Person_~Person]
codetoanalyze/cpp/errors/use_after_free/foreach_map.cpp, use_after_free::Basic_test_double_delete_bad, 3, USE_AFTER_FREE, ERROR, [start of procedure test_double_delete_bad,Skipping Y: function or method not found] codetoanalyze/cpp/errors/use_after_free/foreach_map.cpp, use_after_free::Basic_test_double_delete_bad, 3, USE_AFTER_FREE, ERROR, [start of procedure test_double_delete_bad,Skipping Y: function or method not found]
codetoanalyze/cpp/errors/use_after_free/foreach_map.cpp, use_after_free::Basic_test_for_map_delete_ok_FP, 2, USE_AFTER_FREE, ERROR, [start of procedure test_for_map_delete_ok_FP,Condition is true,Skipping operator*: function or method not found,Condition is true,Skipping operator*: function or method not found,Condition is true,Skipping operator*: function or method not found] codetoanalyze/cpp/errors/use_after_free/foreach_map.cpp, use_after_free::Basic_test_for_map_delete_ok_FP, 2, USE_AFTER_FREE, ERROR, [start of procedure test_for_map_delete_ok_FP,Condition is true,Skipping operator*: function or method not found,Condition is true,Skipping operator*: function or method not found]
codetoanalyze/cpp/errors/use_after_free/foreach_map.cpp, use_after_free::Basic_test_for_umap_delete_ok_FP, 2, USE_AFTER_FREE, ERROR, [start of procedure test_for_umap_delete_ok_FP,Condition is true,Skipping operator*: function or method not found,Condition is true,Skipping operator*: function or method not found,Condition is true,Skipping operator*: function or method not found] codetoanalyze/cpp/errors/use_after_free/foreach_map.cpp, use_after_free::Basic_test_for_umap_delete_ok_FP, 2, USE_AFTER_FREE, ERROR, [start of procedure test_for_umap_delete_ok_FP,Condition is true,Skipping operator*: function or method not found,Condition is true,Skipping operator*: function or method not found]
codetoanalyze/cpp/errors/vector/access_field_later.cpp, getIntPtr, 2, EMPTY_VECTOR_ACCESS, ERROR, [start of procedure getIntPtr()] codetoanalyze/cpp/errors/vector/access_field_later.cpp, getIntPtr, 2, EMPTY_VECTOR_ACCESS, ERROR, [start of procedure getIntPtr()]
codetoanalyze/cpp/errors/vector/access_field_later.cpp, getWithCopy, 2, EMPTY_VECTOR_ACCESS, ERROR, [start of procedure getWithCopy()] codetoanalyze/cpp/errors/vector/access_field_later.cpp, getWithCopy, 2, EMPTY_VECTOR_ACCESS, ERROR, [start of procedure getWithCopy()]
codetoanalyze/cpp/errors/vector/access_field_later.cpp, getWithCopyPtr, 2, EMPTY_VECTOR_ACCESS, ERROR, [start of procedure getWithCopyPtr()] codetoanalyze/cpp/errors/vector/access_field_later.cpp, getWithCopyPtr, 2, EMPTY_VECTOR_ACCESS, ERROR, [start of procedure getWithCopyPtr()]

Loading…
Cancel
Save