From 71a3843746793db2662229a083d4f0c88131b108 Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Thu, 1 Feb 2018 15:01:48 -0800 Subject: [PATCH] Revert occurence counting change Reviewed By: jeremydubreil Differential Revision: D6876136 fbshipit-source-id: 4fc3b1c --- Makefile | 1 - infer/src/backend/InferPrint.ml | 36 ++++++----------- infer/tests/build_systems/ant/issues.exp | 2 +- .../Makefile | 28 ------------- .../fixed.exp | 0 .../introduced.exp | 1 - .../preexisting.exp | 1 - .../src/DiffExample.java.current | 19 --------- .../src/DiffExample.java.previous | 18 --------- .../codetoanalyze/c/bufferoverrun/issues.exp | 2 +- infer/tests/codetoanalyze/cpp/siof/issues.exp | 10 ++--- .../tests/codetoanalyze/java/infer/issues.exp | 2 +- .../codetoanalyze/java/quandary/issues.exp | 40 +++++++++---------- 13 files changed, 41 insertions(+), 119 deletions(-) delete mode 100644 infer/tests/build_systems/differential_introducing_same_warnings/Makefile delete mode 100644 infer/tests/build_systems/differential_introducing_same_warnings/fixed.exp delete mode 100644 infer/tests/build_systems/differential_introducing_same_warnings/introduced.exp delete mode 100644 infer/tests/build_systems/differential_introducing_same_warnings/preexisting.exp delete mode 100644 infer/tests/build_systems/differential_introducing_same_warnings/src/DiffExample.java.current delete mode 100644 infer/tests/build_systems/differential_introducing_same_warnings/src/DiffExample.java.previous diff --git a/Makefile b/Makefile index 932736787..8029e168e 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,6 @@ endif # BUILD_C_ANALYZERS ifeq ($(BUILD_JAVA_ANALYZERS),yes) BUILD_SYSTEMS_TESTS += \ differential_interesting_paths_filter \ - differential_introducing_same_warnings \ differential_skip_anonymous_class_renamings \ differential_skip_duplicated_types_on_filenames \ differential_skip_duplicated_types_on_filenames_with_renamings \ diff --git a/infer/src/backend/InferPrint.ml b/infer/src/backend/InferPrint.ml index d8826a047..a9351a049 100644 --- a/infer/src/backend/InferPrint.ml +++ b/infer/src/backend/InferPrint.ml @@ -45,28 +45,18 @@ let error_desc_to_plain_string error_desc = let error_desc_to_dotty_string error_desc = Localise.error_desc_get_dotty error_desc -let compute_hash - : kind:string -> bug_type:string -> procname:Typ.Procname.t -> file:string -> qualifier:string - -> string = - let counter = Hashtbl.create 128 in - fun ~kind ~bug_type ~procname ~file ~qualifier -> - let base_filename = Filename.basename file in - let hashable_procedure_name = Typ.Procname.hashable_name procname in - let location_independent_qualifier = - (* Removing the line and column information from the error message to make the - hash invariant when moving the source code in the file *) - Str.global_replace (Str.regexp "\\(line\\|column\\)\\ [0-9]+") "_" qualifier - in - let base_hash = - Utils.better_hash - (kind, bug_type, hashable_procedure_name, base_filename, location_independent_qualifier) - in - let index = - let previous = try Hashtbl.find counter base_hash with Not_found -> 0 in - previous + 1 - in - Hashtbl.replace counter base_hash index ; - Caml.Digest.to_hex (Utils.better_hash (base_hash, index)) +let compute_hash (kind: string) (type_str: string) (proc_name: Typ.Procname.t) (filename: string) + (qualifier: string) = + let base_filename = Filename.basename filename in + let hashable_procedure_name = Typ.Procname.hashable_name proc_name in + let location_independent_qualifier = + (* Removing the line and column information from the error message to make the + hash invariant when moving the source code in the file *) + Str.global_replace (Str.regexp "\\(line\\|column\\)\\ [0-9]+") "_" qualifier + in + Utils.better_hash + (kind, type_str, hashable_procedure_name, base_filename, location_independent_qualifier) + |> Caml.Digest.to_hex let exception_value = "exception" @@ -301,7 +291,7 @@ module IssuesJson = struct ; bug_trace= loc_trace_to_jsonbug_record err_data.loc_trace key.err_kind ; key= err_data.node_id_key.node_key |> Caml.Digest.to_hex ; qualifier_tags= Localise.Tags.tag_value_records_of_tags key.err_desc.tags - ; hash= compute_hash ~kind ~bug_type ~procname ~file ~qualifier + ; hash= compute_hash kind bug_type procname file qualifier ; dotty= error_desc_to_dotty_string key.err_desc ; infer_source_loc= json_ml_loc ; bug_type_hum= key.err_name.IssueType.hum diff --git a/infer/tests/build_systems/ant/issues.exp b/infer/tests/build_systems/ant/issues.exp index fbffcec43..3e356b5c5 100644 --- a/infer/tests/build_systems/ant/issues.exp +++ b/infer/tests/build_systems/ant/issues.exp @@ -154,8 +154,8 @@ codetoanalyze/java/infer/ResourceLeaks.java, int ResourceLeaks.fileOutputStreamT codetoanalyze/java/infer/ResourceLeaks.java, int ResourceLeaks.readConfigNotCloseStream(String), 5, RESOURCE_LEAK, [start of procedure readConfigNotCloseStream(...)] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.activityObtainTypedArrayAndLeak(Activity), 2, RESOURCE_LEAK, [start of procedure activityObtainTypedArrayAndLeak(...),start of procedure ignore(...),return from a call to void ResourceLeaks.ignore(TypedArray)] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.contextObtainTypedArrayAndLeak(Context), 2, RESOURCE_LEAK, [start of procedure contextObtainTypedArrayAndLeak(...),start of procedure ignore(...),return from a call to void ResourceLeaks.ignore(TypedArray)] -codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.copyFileLeak(File,File), 11, RESOURCE_LEAK, [start of procedure copyFileLeak(...),exception java.io.FileNotFoundException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.copyFileLeak(File,File), 11, RESOURCE_LEAK, [start of procedure copyFileLeak(...),Skipping transferTo(...): unknown method,Taking true branch,exception java.io.IOException] +codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.copyFileLeak(File,File), 11, RESOURCE_LEAK, [start of procedure copyFileLeak(...),exception java.io.FileNotFoundException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.deflaterLeak(), 1, RESOURCE_LEAK, [start of procedure deflaterLeak()] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.fileInputStreamNotClosedAfterRead(), 6, RESOURCE_LEAK, [start of procedure fileInputStreamNotClosedAfterRead(),exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.fileOutputStreamNotClosed(), 1, RESOURCE_LEAK, [start of procedure fileOutputStreamNotClosed()] diff --git a/infer/tests/build_systems/differential_introducing_same_warnings/Makefile b/infer/tests/build_systems/differential_introducing_same_warnings/Makefile deleted file mode 100644 index b52ee9648..000000000 --- a/infer/tests/build_systems/differential_introducing_same_warnings/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2017 - present Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -# E2E test involving the skip_duplicated_types_on_filenames filter - -TESTS_DIR = ../.. -CLEAN_EXTRA = *.class src/*.java - -CLASSPATH = - -include ../../differential.make -include ../../java.make - -$(CURRENT_REPORT): - $(QUIET)$(COPY) src/DiffExample.java.current src/DiffExample.java - $(QUIET)$(call silent_on_success,Testing\ - Differential same warning as introduced: current,\ - $(INFER_BIN) -o $(CURRENT_DIR) --eradicate-only -- $(JAVAC) -cp $(JSR305) src/DiffExample.java) - -$(PREVIOUS_REPORT): - $(QUIET)$(COPY) src/DiffExample.java.previous src/DiffExample.java - $(QUIET)$(call silent_on_success,Testing\ - Differential same warning as introduced: previous,\ - $(INFER_BIN) -o $(PREVIOUS_DIR) --eradicate-only -- $(JAVAC) -cp $(JSR305) src/DiffExample.java) diff --git a/infer/tests/build_systems/differential_introducing_same_warnings/fixed.exp b/infer/tests/build_systems/differential_introducing_same_warnings/fixed.exp deleted file mode 100644 index e69de29bb..000000000 diff --git a/infer/tests/build_systems/differential_introducing_same_warnings/introduced.exp b/infer/tests/build_systems/differential_introducing_same_warnings/introduced.exp deleted file mode 100644 index 7311d71b7..000000000 --- a/infer/tests/build_systems/differential_introducing_same_warnings/introduced.exp +++ /dev/null @@ -1 +0,0 @@ -ERADICATE_NULL_METHOD_CALL, src/DiffExample.java, void Example.theSecondWarningReportedAsIntroducedBad(), 2, Example.theSecondWarningReportedAsIntroducedBad():void.769a1d033f7c0ce662bd32cbfd6749ac, Example.theSecondWarningReportedAsIntroducedBad():void diff --git a/infer/tests/build_systems/differential_introducing_same_warnings/preexisting.exp b/infer/tests/build_systems/differential_introducing_same_warnings/preexisting.exp deleted file mode 100644 index a044224c8..000000000 --- a/infer/tests/build_systems/differential_introducing_same_warnings/preexisting.exp +++ /dev/null @@ -1 +0,0 @@ -ERADICATE_NULL_METHOD_CALL, src/DiffExample.java, void Example.theSecondWarningReportedAsIntroducedBad(), 1, Example.theSecondWarningReportedAsIntroducedBad():void.769a1d033f7c0ce662bd32cbfd6749ac, Example.theSecondWarningReportedAsIntroducedBad():void diff --git a/infer/tests/build_systems/differential_introducing_same_warnings/src/DiffExample.java.current b/infer/tests/build_systems/differential_introducing_same_warnings/src/DiffExample.java.current deleted file mode 100644 index ed1cda3ea..000000000 --- a/infer/tests/build_systems/differential_introducing_same_warnings/src/DiffExample.java.current +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2017 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import javax.annotation.Nullable; - -class Example { - native @Nullable Object mayReturnsNull(); - - void theSecondWarningReportedAsIntroducedBad() { - mayReturnsNull().toString(); - mayReturnsNull().toString(); // Infer should report this one as introduced - } -} diff --git a/infer/tests/build_systems/differential_introducing_same_warnings/src/DiffExample.java.previous b/infer/tests/build_systems/differential_introducing_same_warnings/src/DiffExample.java.previous deleted file mode 100644 index 6a27fa74a..000000000 --- a/infer/tests/build_systems/differential_introducing_same_warnings/src/DiffExample.java.previous +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2017 - present Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import javax.annotation.Nullable; - -class Example { - native @Nullable Object mayReturnsNull(); - - void theSecondWarningReportedAsIntroducedBad() { - mayReturnsNull().toString(); - } -} diff --git a/infer/tests/codetoanalyze/c/bufferoverrun/issues.exp b/infer/tests/codetoanalyze/c/bufferoverrun/issues.exp index 1c2447745..66edc52a4 100644 --- a/infer/tests/codetoanalyze/c/bufferoverrun/issues.exp +++ b/infer/tests/codetoanalyze/c/bufferoverrun/issues.exp @@ -8,8 +8,8 @@ codetoanalyze/c/bufferoverrun/cast.c, cast2_Good_FP, 2, BUFFER_OVERRUN_L1, [Arra codetoanalyze/c/bufferoverrun/do_while.c, do_while, 2, BUFFER_OVERRUN_L4, [ArrayDeclaration,Assignment,Call,Assignment,ArrayAccess: Offset: [0, +oo] Size: [10, 10] @ codetoanalyze/c/bufferoverrun/do_while.c:18:5 by call `do_while_sub()` ] codetoanalyze/c/bufferoverrun/duplicates.c, one_alarm_is_enough, 2, BUFFER_OVERRUN_L1, [ArrayDeclaration,Call,ArrayAccess: Offset: [1, 1] Size: [1, 1] @ codetoanalyze/c/bufferoverrun/duplicates.c:11:7 by call `two_accesses()` ] codetoanalyze/c/bufferoverrun/duplicates.c, tsa_one_alarm_Bad, 0, BUFFER_OVERRUN_L1, [Call,ArrayDeclaration,ArrayAccess: Offset: [3, 3] Size: [1, 1] @ codetoanalyze/c/bufferoverrun/duplicates.c:23:3 by call `two_symbolic_accesses()` ] -codetoanalyze/c/bufferoverrun/duplicates.c, tsa_two_alarms_Bad, 0, BUFFER_OVERRUN_L1, [Call,ArrayDeclaration,ArrayAccess: Offset: [-1, -1] Size: [1, 1] @ codetoanalyze/c/bufferoverrun/duplicates.c:24:3 by call `two_symbolic_accesses()` ] codetoanalyze/c/bufferoverrun/duplicates.c, tsa_two_alarms_Bad, 0, BUFFER_OVERRUN_L1, [Call,ArrayDeclaration,ArrayAccess: Offset: [1, 1] Size: [1, 1] @ codetoanalyze/c/bufferoverrun/duplicates.c:23:3 by call `two_symbolic_accesses()` ] +codetoanalyze/c/bufferoverrun/duplicates.c, tsa_two_alarms_Bad, 0, BUFFER_OVERRUN_L1, [Call,ArrayDeclaration,ArrayAccess: Offset: [-1, -1] Size: [1, 1] @ codetoanalyze/c/bufferoverrun/duplicates.c:24:3 by call `two_symbolic_accesses()` ] codetoanalyze/c/bufferoverrun/external.c, extern_bad, 5, BUFFER_OVERRUN_L5, [Assignment,ArrayAccess: Offset: [-oo, +oo] Size: [0, +oo]] codetoanalyze/c/bufferoverrun/external.c, extern_bad, 10, BUFFER_OVERRUN_L1, [ArrayDeclaration,ArrayAccess: Offset: [30, 30] Size: [10, 10]] codetoanalyze/c/bufferoverrun/for_loop.c, for_loop, 10, BUFFER_OVERRUN_L3, [Call,ArrayDeclaration,Assignment,Assignment,Return,Assignment,Assignment,ArrayAccess: Offset: [0, 9] Size: [5, 10]] diff --git a/infer/tests/codetoanalyze/cpp/siof/issues.exp b/infer/tests/codetoanalyze/cpp/siof/issues.exp index 2808e94db..98b7298cf 100644 --- a/infer/tests/codetoanalyze/cpp/siof/issues.exp +++ b/infer/tests/codetoanalyze/cpp/siof/issues.exp @@ -1,17 +1,17 @@ codetoanalyze/cpp/siof/siof/duplicate_reports.cpp, __infer_globals_initializer_many_paths_to_siof_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of many_paths_to_siof_bad,call to X_X,call to access_rick,access to rick|] codetoanalyze/cpp/siof/siof/duplicate_reports.cpp, __infer_globals_initializer_many_paths_to_siof_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of many_paths_to_siof_bad,call to X_X,call to nested_access,access to dangerous|] -codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_X::static_pod_accesses_non_pod_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of X::static_pod_accesses_non_pod_bad,call to access_to_non_pod,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_X::static_pod_accesses_non_pod_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of X::static_pod_accesses_non_pod_bad,call to access_to_non_pod,access to global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] -codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_another_global_object2_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_global_object2_bad,call to access_to_non_pod,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] +codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_X::static_pod_accesses_non_pod_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of X::static_pod_accesses_non_pod_bad,call to access_to_non_pod,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_another_global_object2_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_global_object2_bad,call to access_to_non_pod,access to global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] +codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_another_global_object2_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_global_object2_bad,call to access_to_non_pod,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_another_global_object3_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_global_object3_bad,call to access_to_templated_non_pod,access to global_object3|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_another_global_object_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_global_object_bad,call to SomeOtherNonPODObject_SomeOtherNonPODObject,access to extern_global_object|] -codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_initWithGlobal_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of initWithGlobal_bad,call to getGlobalNonPOD,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_initWithGlobal_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of initWithGlobal_bad,call to getGlobalNonPOD,access to global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] -codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_pod_accesses_non_pod_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of pod_accesses_non_pod_bad,call to access_to_non_pod,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] +codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_initWithGlobal_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of initWithGlobal_bad,call to getGlobalNonPOD,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_pod_accesses_non_pod_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of pod_accesses_non_pod_bad,call to access_to_non_pod,access to global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] -codetoanalyze/cpp/siof/siof/siof_templated.cpp, __infer_globals_initializer_another_templated_global_object2_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_templated_global_object2_bad,call to access_to_non_pod,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] +codetoanalyze/cpp/siof/siof/siof.cpp, __infer_globals_initializer_pod_accesses_non_pod_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of pod_accesses_non_pod_bad,call to access_to_non_pod,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof_templated.cpp, __infer_globals_initializer_another_templated_global_object2_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_templated_global_object2_bad,call to access_to_non_pod,access to global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] +codetoanalyze/cpp/siof/siof/siof_templated.cpp, __infer_globals_initializer_another_templated_global_object2_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_templated_global_object2_bad,call to access_to_non_pod,access to some_other_global_object2|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof_templated.cpp, __infer_globals_initializer_another_templated_global_object3_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_templated_global_object3_bad,call to access_to_templated_non_pod,access to global_object3|codetoanalyze/cpp/siof/siof/siof_different_tu.cpp] codetoanalyze/cpp/siof/siof/siof_templated.cpp, __infer_globals_initializer_another_templated_global_object_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of another_templated_global_object_bad,call to SomeOtherTemplatedNonPODObject<_Bool>_SomeOtherTemplatedNonPODObject,access to extern_global_object|] codetoanalyze/cpp/siof/siof/std_ios_base_init.cpp, __infer_globals_initializer_global_std_cerr_access_bad, 0, STATIC_INITIALIZATION_ORDER_FIASCO, [initialization of global_std_cerr_access_bad,call to return_4_SIOF,call to printing_SIOF,access to std::cerr|] diff --git a/infer/tests/codetoanalyze/java/infer/issues.exp b/infer/tests/codetoanalyze/java/infer/issues.exp index 2227ec935..bda193a55 100644 --- a/infer/tests/codetoanalyze/java/infer/issues.exp +++ b/infer/tests/codetoanalyze/java/infer/issues.exp @@ -163,8 +163,8 @@ codetoanalyze/java/infer/ResourceLeaks.java, int ResourceLeaks.readConfigNotClos codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.NoResourceLeakWarningAfterCheckState(File,int), 2, PRECONDITION_NOT_MET, [start of procedure NoResourceLeakWarningAfterCheckState(...),Taking false branch] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.activityObtainTypedArrayAndLeak(Activity), 2, RESOURCE_LEAK, [start of procedure activityObtainTypedArrayAndLeak(...),start of procedure ignore(...),return from a call to void ResourceLeaks.ignore(TypedArray)] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.contextObtainTypedArrayAndLeak(Context), 2, RESOURCE_LEAK, [start of procedure contextObtainTypedArrayAndLeak(...),start of procedure ignore(...),return from a call to void ResourceLeaks.ignore(TypedArray)] -codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.copyFileLeak(File,File), 11, RESOURCE_LEAK, [start of procedure copyFileLeak(...),exception java.io.FileNotFoundException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.copyFileLeak(File,File), 11, RESOURCE_LEAK, [start of procedure copyFileLeak(...),Skipping transferTo(...): unknown method,Taking true branch,exception java.io.IOException] +codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.copyFileLeak(File,File), 11, RESOURCE_LEAK, [start of procedure copyFileLeak(...),exception java.io.FileNotFoundException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.deflaterLeak(), 1, RESOURCE_LEAK, [start of procedure deflaterLeak()] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.fileInputStreamNotClosedAfterRead(), 6, RESOURCE_LEAK, [start of procedure fileInputStreamNotClosedAfterRead(),exception java.io.IOException] codetoanalyze/java/infer/ResourceLeaks.java, void ResourceLeaks.fileOutputStreamNotClosed(), 1, RESOURCE_LEAK, [start of procedure fileOutputStreamNotClosed()] diff --git a/infer/tests/codetoanalyze/java/quandary/issues.exp b/infer/tests/codetoanalyze/java/quandary/issues.exp index e7c726998..d9f13a066 100644 --- a/infer/tests/codetoanalyze/java/quandary/issues.exp +++ b/infer/tests/codetoanalyze/java/quandary/issues.exp @@ -131,46 +131,46 @@ codetoanalyze/java/quandary/Interprocedural.java, void Interprocedural.returnSou codetoanalyze/java/quandary/Interprocedural.java, void Interprocedural.returnSourceViaParameter2Bad(Interprocedural$Obj,Interprocedural$Obj), 3, QUANDARY_TAINT_ERROR, [Return from Object InferTaint.inferSecretSource(),Call to void InferTaint.inferSensitiveSink(Object) with tainted index 0] codetoanalyze/java/quandary/Interprocedural.java, void Interprocedural.setGlobalThenCallSinkBad(), 2, QUANDARY_TAINT_ERROR, [Return from Object InferTaint.inferSecretSource(),Call to void Interprocedural.callSinkOnGlobal() with tainted index 0,Call to void InferTaint.inferSensitiveSink(Object) with tainted index 0] codetoanalyze/java/quandary/Interprocedural.java, void Interprocedural.singlePassthroughBad(), 3, QUANDARY_TAINT_ERROR, [Return from Object InferTaint.inferSecretSource(),Call to void InferTaint.inferSensitiveSink(Object) with tainted index 0] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getVoiceMailNumber(),Call to int Log.e(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from float Location.getSpeed(),Call to int Log.e(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getDeviceId(),Call to int Log.e(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSimSerialNumber(),Call to int Log.e(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getLine1Number(),Call to int Log.e(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from double Location.getAltitude(),Call to int Log.e(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSubscriberId(),Call to int Log.e(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from double Location.getLongitude(),Call to int Log.e(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from float Location.getBearing(),Call to int Log.e(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getLine1Number(),Call to int Log.e(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from double Location.getLatitude(),Call to int Log.e(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getVoiceMailNumber(),Call to int Log.e(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 36, LOGGING_PRIVATE_DATA, [Return from double Location.getAltitude(),Call to int Log.e(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSubscriberId(),Call to int Log.println(int,String,String) with tainted index 2] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getDeviceId(),Call to int Log.println(int,String,String) with tainted index 2] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from double Location.getLongitude(),Call to int Log.println(int,String,String) with tainted index 2] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getLine1Number(),Call to int Log.println(int,String,String) with tainted index 2] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from double Location.getAltitude(),Call to int Log.println(int,String,String) with tainted index 2] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getVoiceMailNumber(),Call to int Log.println(int,String,String) with tainted index 2] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from float Location.getBearing(),Call to int Log.println(int,String,String) with tainted index 2] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSimSerialNumber(),Call to int Log.println(int,String,String) with tainted index 2] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from double Location.getLatitude(),Call to int Log.println(int,String,String) with tainted index 2] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from double Location.getAltitude(),Call to int Log.println(int,String,String) with tainted index 2] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getDeviceId(),Call to int Log.println(int,String,String) with tainted index 2] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSubscriberId(),Call to int Log.println(int,String,String) with tainted index 2] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from float Location.getSpeed(),Call to int Log.println(int,String,String) with tainted index 2] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from double Location.getLongitude(),Call to int Log.println(int,String,String) with tainted index 2] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getLine1Number(),Call to int Log.println(int,String,String) with tainted index 2] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 37, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSimSerialNumber(),Call to int Log.println(int,String,String) with tainted index 2] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSimSerialNumber(),Call to int Log.w(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSubscriberId(),Call to int Log.w(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from double Location.getAltitude(),Call to int Log.w(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getDeviceId(),Call to int Log.w(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getVoiceMailNumber(),Call to int Log.w(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from double Location.getAltitude(),Call to int Log.w(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from double Location.getLatitude(),Call to int Log.w(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from float Location.getBearing(),Call to int Log.w(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from double Location.getLongitude(),Call to int Log.w(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSimSerialNumber(),Call to int Log.w(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getLine1Number(),Call to int Log.w(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getDeviceId(),Call to int Log.w(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from float Location.getSpeed(),Call to int Log.w(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 38, LOGGING_PRIVATE_DATA, [Return from float Location.getBearing(),Call to int Log.w(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from double Location.getLatitude(),Call to int Log.wtf(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSimSerialNumber(),Call to int Log.wtf(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getDeviceId(),Call to int Log.wtf(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from double Location.getAltitude(),Call to int Log.wtf(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from double Location.getLongitude(),Call to int Log.wtf(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getLine1Number(),Call to int Log.wtf(String,String) with tainted index 1] -codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSubscriberId(),Call to int Log.wtf(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getVoiceMailNumber(),Call to int Log.wtf(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from float Location.getSpeed(),Call to int Log.wtf(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from double Location.getLongitude(),Call to int Log.wtf(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSubscriberId(),Call to int Log.wtf(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getSimSerialNumber(),Call to int Log.wtf(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from double Location.getLatitude(),Call to int Log.wtf(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from double Location.getAltitude(),Call to int Log.wtf(String,String) with tainted index 1] codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from float Location.getBearing(),Call to int Log.wtf(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getDeviceId(),Call to int Log.wtf(String,String) with tainted index 1] +codetoanalyze/java/quandary/LoggingPrivateData.java, void LoggingPrivateData.logAllSourcesBad(Location,TelephonyManager), 39, LOGGING_PRIVATE_DATA, [Return from String TelephonyManager.getLine1Number(),Call to int Log.wtf(String,String) with tainted index 1] codetoanalyze/java/quandary/Recursion.java, void Recursion.callSinkThenDivergeBad(), 1, QUANDARY_TAINT_ERROR, [Return from Object InferTaint.inferSecretSource(),Call to void Recursion.callSinkThenDiverge(Object) with tainted index 0,Call to void InferTaint.inferSensitiveSink(Object) with tainted index 0] codetoanalyze/java/quandary/Recursion.java, void Recursion.safeRecursionCallSinkBad(), 1, QUANDARY_TAINT_ERROR, [Return from Object InferTaint.inferSecretSource(),Call to void Recursion.safeRecursionCallSink(int,Object) with tainted index 0,Call to void InferTaint.inferSensitiveSink(Object) with tainted index 0] codetoanalyze/java/quandary/Serialization.java, Object Serialization.taintedObjectInputStreamBad(), 2, QUANDARY_TAINT_ERROR, [Return from Object InferTaint.inferSecretSource(),Call to ObjectInputStream.(InputStream) with tainted index 1]