[infer] add the Fragment from the androidx package to the hard copied lists

Reviewed By: ngorogiannis

Differential Revision: D14983576

fbshipit-source-id: 3e6dba88d
master
Jeremy Dubreil 6 years ago committed by Facebook Github Bot
parent 4a91616390
commit 8201bc1c4e

@ -246,6 +246,7 @@ let initializer_classes =
; "android.app.Fragment" ; "android.app.Fragment"
; "android.app.Service" ; "android.app.Service"
; "android.support.v4.app.Fragment" ; "android.support.v4.app.Fragment"
; "androidx.fragment.app.Fragment"
; "junit.framework.TestCase" ] ; "junit.framework.TestCase" ]

@ -140,9 +140,9 @@ end = struct
QualifiedCppName.Match.of_fuzzy_qual_names class_names QualifiedCppName.Match.of_fuzzy_qual_names class_names
(** C++ guard classes used for scope-based lock management. (** C++ guard classes used for scope-based lock management.
NB we pretend all classes below implement the mutex interface even though only NB we pretend all classes below implement the mutex interface even though only
[shared_lock] and [unique_lock] do, for simplicity. The comments summarise which [shared_lock] and [unique_lock] do, for simplicity. The comments summarise which
methods are implemented. *) methods are implemented. *)
let guards = let guards =
(* TODO std::scoped_lock *) (* TODO std::scoped_lock *)
@ -346,6 +346,7 @@ let ui_matcher_records =
(* search_superclasses is true by default in how [default] is treated *) (* search_superclasses is true by default in how [default] is treated *)
[ {default with classname= "android.support.v4.app.Fragment"; methods= fragment_methods} [ {default with classname= "android.support.v4.app.Fragment"; methods= fragment_methods}
; {default with classname= "android.app.Fragment"; methods= fragment_methods} ; {default with classname= "android.app.Fragment"; methods= fragment_methods}
; {default with classname= "androidx.fragment.app.Fragment"; methods= fragment_methods}
; {default with classname= "android.content.ContentProvider"; methods= ["onCreate"]} ; {default with classname= "android.content.ContentProvider"; methods= ["onCreate"]}
; {default with classname= "android.content.BroadcastReceiver"; methods= ["onReceive"]} ; {default with classname= "android.content.BroadcastReceiver"; methods= ["onReceive"]}
; { default with ; { default with
@ -375,8 +376,8 @@ let if_pred_evalopt ~pred ~f x =
IOption.if_none_evalopt x ~f:(fun () -> if pred () then Some (f ()) else None) IOption.if_none_evalopt x ~f:(fun () -> if pred () then Some (f ()) else None)
(* assume that methods annotated with @MainThread, @UiThread, (* assume that methods annotated with @MainThread, @UiThread,
and any string starting with "On" always run on the UI thread. and any string starting with "On" always run on the UI thread.
We do the latter because there are too many to precisely list. *) We do the latter because there are too many to precisely list. *)
let is_uithread annots = let is_uithread annots =
let f (annot, _) = let f (annot, _) =

@ -191,7 +191,10 @@ module SourceKind = struct
let method_name = Typ.Procname.Java.get_method java_pname in let method_name = Typ.Procname.Java.get_method java_pname in
let taint_matching_supertype typename = let taint_matching_supertype typename =
match (Typ.Name.name typename, method_name) with match (Typ.Name.name typename, method_name) with
| ( ("android.app.Activity" | "android.app.Fragment" | "android.support.v4.app.Fragment") | ( ( "android.app.Activity"
| "android.app.Fragment"
| "android.support.v4.app.Fragment"
| "androidx.fragment.app.Fragment" )
, ("onActivityResult" | "onNewIntent") ) -> , ("onActivityResult" | "onNewIntent") ) ->
Some (taint_formals_with_types ["android.content.Intent"] Intent formals) Some (taint_formals_with_types ["android.content.Intent"] Intent formals)
| ( "android.app.Service" | ( "android.app.Service"
@ -391,19 +394,22 @@ module SinkKind = struct
taint_nth 1 [StartComponent] taint_nth 1 [StartComponent]
| ( ( "android.app.Activity" | ( ( "android.app.Activity"
| "android.content.Context" | "android.content.Context"
| "android.support.v4.app.Fragment" ) | "android.support.v4.app.Fragment"
| "androidx.fragment.app.Fragment" )
, "startIntentSenderForResult" ) -> , "startIntentSenderForResult" ) ->
taint_nth 2 [StartComponent] taint_nth 2 [StartComponent]
| "android.app.Activity", "startIntentSenderFromChild" -> | "android.app.Activity", "startIntentSenderFromChild" ->
taint_nth 3 [StartComponent] taint_nth 3 [StartComponent]
| ( ( "android.app.Fragment" | ( ( "android.app.Fragment"
| "android.content.Context" | "android.content.Context"
| "android.support.v4.app.Fragment" ) | "android.support.v4.app.Fragment"
| "androidx.fragment.app.Fragment" )
, "startActivity" ) -> , "startActivity" ) ->
taint_nth 0 [StartComponent; StartComponentForInsecureIntentHandling] taint_nth 0 [StartComponent; StartComponentForInsecureIntentHandling]
| ( ( "android.app.Fragment" | ( ( "android.app.Fragment"
| "android.content.Context" | "android.content.Context"
| "android.support.v4.app.Fragment" ) | "android.support.v4.app.Fragment"
| "androidx.fragment.app.Fragment" )
, ( "bindService" , ( "bindService"
| "sendBroadcast" | "sendBroadcast"
| "sendBroadcastAsUser" | "sendBroadcastAsUser"

Loading…
Cancel
Save