@ -133,47 +133,63 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
| _
| _
-> Unknown
-> Unknown
let get_container_access pn tenv =
let get_container_access =
match pn with
let is_cpp_container_read =
| Typ . Procname . Java java_pname
let matcher = QualifiedCppName . Match . of_fuzzy_qual_names [ " std::map::find " ] in
-> let typename = Typ . Name . Java . from_string ( Typ . Procname . java_get_class_name java_pname ) in
fun pname ->
let get_container_access_ typename =
QualifiedCppName . Match . match_qualifiers matcher ( Typ . Procname . get_qualifiers pname )
match ( Typ . Name . name typename , Typ . Procname . java_get_method java_pname ) with
and is_cpp_container_write =
| ( ( " android.util.SparseArray " | " android.support.v4.util.SparseArrayCompat " )
let matcher =
, ( " append " | " clear " | " delete " | " put " | " remove " | " removeAt " | " removeAtRange "
QualifiedCppName . Match . of_fuzzy_qual_names [ " std::map::operator[] " ; " std::map::erase " ]
| " setValueAt " ) )
in
-> Some ContainerWrite
fun pname ->
| ( ( " android.util.SparseArray " | " android.support.v4.util.SparseArrayCompat " )
QualifiedCppName . Match . match_qualifiers matcher ( Typ . Procname . get_qualifiers pname )
, ( " clone " | " get " | " indexOfKey " | " indexOfValue " | " keyAt " | " size " | " valueAt " ) )
in
-> Some ContainerRead
fun pn tenv ->
| ( " android.support.v4.util.SimpleArrayMap "
match pn with
, ( " clear " | " ensureCapacity " | " put " | " putAll " | " remove " | " removeAt " | " setValueAt " )
| Typ . Procname . Java java_pname
)
-> let typename = Typ . Name . Java . from_string ( Typ . Procname . java_get_class_name java_pname ) in
-> Some ContainerWrite
let get_container_access_ typename =
| ( " android.support.v4.util.SimpleArrayMap "
match ( Typ . Name . name typename , Typ . Procname . java_get_method java_pname ) with
, ( " containsKey " | " containsValue " | " get " | " hashCode " | " indexOfKey " | " isEmpty "
| ( ( " android.util.SparseArray " | " android.support.v4.util.SparseArrayCompat " )
| " keyAt " | " size " | " valueAt " ) )
, ( " append " | " clear " | " delete " | " put " | " remove " | " removeAt " | " removeAtRange "
-> Some ContainerRead
| " setValueAt " ) )
| " android.support.v4.util.Pools$SimplePool " , ( " acquire " | " release " )
-> Some ContainerWrite
-> Some ContainerWrite
| ( ( " android.util.SparseArray " | " android.support.v4.util.SparseArrayCompat " )
| " java.util.List " , ( " add " | " addAll " | " clear " | " remove " | " set " )
, ( " clone " | " get " | " indexOfKey " | " indexOfValue " | " keyAt " | " size " | " valueAt " ) )
-> Some ContainerWrite
-> Some ContainerRead
| ( " java.util.List "
| ( " android.support.v4.util.SimpleArrayMap "
, ( " contains " | " containsAll " | " equals " | " get " | " hashCode " | " indexOf " | " isEmpty "
, ( " clear " | " ensureCapacity " | " put " | " putAll " | " remove " | " removeAt "
| " iterator " | " lastIndexOf " | " listIterator " | " size " | " toArray " ) )
| " setValueAt " ) )
-> Some ContainerRead
-> Some ContainerWrite
| " java.util.Map " , ( " clear " | " put " | " putAll " | " remove " )
| ( " android.support.v4.util.SimpleArrayMap "
-> Some ContainerWrite
, ( " containsKey " | " containsValue " | " get " | " hashCode " | " indexOfKey " | " isEmpty "
| ( " java.util.Map "
| " keyAt " | " size " | " valueAt " ) )
, ( " containsKey " | " containsValue " | " entrySet " | " equals " | " get " | " hashCode "
-> Some ContainerRead
| " isEmpty " | " keySet " | " size " | " values " ) )
| " android.support.v4.util.Pools$SimplePool " , ( " acquire " | " release " )
-> Some ContainerRead
-> Some ContainerWrite
| _
| " java.util.List " , ( " add " | " addAll " | " clear " | " remove " | " set " )
-> None
-> Some ContainerWrite
in
| ( " java.util.List "
PatternMatch . supertype_find_map_opt tenv get_container_access_ typename
, ( " contains " | " containsAll " | " equals " | " get " | " hashCode " | " indexOf "
| _
| " isEmpty " | " iterator " | " lastIndexOf " | " listIterator " | " size " | " toArray " ) )
-> None
-> Some ContainerRead
| " java.util.Map " , ( " clear " | " put " | " putAll " | " remove " )
-> Some ContainerWrite
| ( " java.util.Map "
, ( " containsKey " | " containsValue " | " entrySet " | " equals " | " get " | " hashCode "
| " isEmpty " | " keySet " | " size " | " values " ) )
-> Some ContainerRead
| _
-> None
in
PatternMatch . supertype_find_map_opt tenv get_container_access_ typename
| Typ . Procname . ObjC_Cpp _ as pname when is_cpp_container_read pname
-> Some ContainerRead
| Typ . Procname . ObjC_Cpp _ as pname when is_cpp_container_write pname
-> Some ContainerWrite
| _
-> None
(* propagate attributes from the leaves to the root of an RHS Hil expression *)
(* propagate attributes from the leaves to the root of an RHS Hil expression *)
let rec attributes_of_expr attribute_map e =
let rec attributes_of_expr attribute_map e =