mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Add tables, improve tests, make fixes
This commit is contained in:
@@ -28,7 +28,7 @@ private class GuavaCollectCsv extends SummaryModelCsv {
|
||||
"com.google.common.collect;Multimap;true;get;(Object);;MapValue of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Multimap;true;keys;();;MapKey of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Multimap;true;keySet;();;MapKey of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Multimap;true;values();;MapValue of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Multimap;true;values;();;MapValue of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Multimap;true;put;(Object,Object);;Argument[0];MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;Multimap;true;put;(Object,Object);;Argument[1];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;Multimap;true;putAll;(Object,Iterable);;Argument[0];MapKey of Argument[-1];value",
|
||||
@@ -36,12 +36,37 @@ private class GuavaCollectCsv extends SummaryModelCsv {
|
||||
"com.google.common.collect;Multimap;true;putAll;(Multimap);;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;Multimap;true;putAll;(Multimap);;MapValue of Argument[0];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;Multimap;true;removeAll;(Object);;MapValue of Argument[-1];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;Multimap;true;replaceValues;(Object,Iterable);;MapValue of Argument[-1];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;Multimap;true;replaceValues(Object,Iterable);;Argument[0];MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;Multimap;true;replaceValues(Object,Iterable);;Element of Argument[0];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;Multimap;true;replaceValues;(Object,Iterable);;MapValue of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Multimap;true;replaceValues;(Object,Iterable);;Argument[0];MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;Multimap;true;replaceValues;(Object,Iterable);;Element of Argument[1];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableMultimap;true;inverse;();;MapKey of Argument[-1];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableMultimap;true;inverse;();;MapValue of Argument[-1];MapKey of ReturnValue;value",
|
||||
// Tables (TODO)
|
||||
// Tables
|
||||
"com.google.common.collect;Table<>$Cell;true;getRowKey;();;SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;Table<>$Cell;true;getColumnKey;();;SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;Table<>$Cell;true;getValue;();;MapValue of Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;cellSet;();;MapKey of Argument[-1];MapKey of Element of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;cellSet;();;MapValue of Argument[-1];MapValue of Element of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;row;(Object);;SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of Argument[-1];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;row;(Object);;MapValue of Argument[-1];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;rowKeySet;();;SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;rowMap;();;SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of Argument[-1];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;rowMap;();;SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of Argument[-1];MapKey of MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;rowMap;();;MapValue of Argument[-1];MapValue of MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;column;(Object);;SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of Argument[-1];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;column;(Object);;MapValue of Argument[-1];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;columnKeySet;();;SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;columnMap;();;SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of Argument[-1];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;columnMap;();;SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of Argument[-1];MapKey of MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;columnMap;();;MapValue of Argument[-1];MapValue of MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;values;();;MapValue of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;get;(Object,Object);;MapValue of Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;remove;(Object,Object);;MapValue of Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;Table;true;put;(Object,Object,Object);;Argument[0];SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;Table;true;put;(Object,Object,Object);;Argument[1];SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;Table;true;put;(Object,Object,Object);;Argument[2];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;Table;true;putAll;(Table);;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;Table;true;putAll;(Table);;MapValue of Argument[0];MapValue of Argument[-1];value",
|
||||
// Misc collections and utilities
|
||||
"com.google.common.collect;ImmutableCollection;true;asList;();;Element of Argument[-1];Element of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableList;true;reverse;();;Element of Argument[-1];Element of ReturnValue;value",
|
||||
@@ -94,6 +119,21 @@ private class GuavaCollectCsv extends SummaryModelCsv {
|
||||
"com.google.common.collect;ImmutableMultimap<>$Builder;true;putAll;(Object,Iterable);;Element of Argument[1];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableMultimap<>$Builder;true;putAll;(Object,Iterable);;Argument[0];MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableMultimap<>$Builder;true;putAll;(Object,Object[]);;ArrayElement of Argument[1];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;build;();;SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of Argument[-1];SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;build;();;SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of Argument[-1];SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;build;();;MapValue of Argument[-1];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;orderRowsBy;(Comparator);;Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;orderColumnsBy;(Comparator);;Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;put;(Object,Object,Object);;Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;put;(Cell);;Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;putAll;(Table);;Argument[-1];ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;put;(Object,Object,Object);;Argument[0];SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;put;(Object,Object,Object);;Argument[1];SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;put;(Object,Object,Object);;Argument[2];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;put;(Cell);;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;put;(Cell);;MapValue of Argument[0];MapValue of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;putAll;(Table);;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"com.google.common.collect;ImmutableTable<>$Builder;true;putAll;(Table);;MapValue of Argument[0];MapValue of Argument[-1];value",
|
||||
// `of` methods
|
||||
"com.google.common.collect;ImmutableList;true;of;;;Argument[0..11];Element of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableList;true;of;;;ArrayElement of Argument[12];Element of ReturnValue;value",
|
||||
@@ -125,6 +165,9 @@ private class GuavaCollectCsv extends SummaryModelCsv {
|
||||
"com.google.common.collect;ImmutableMultimap;true;of;;;Argument[9];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableClassToInstanceMap;true;of;(Class,Object);;Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableClassToInstanceMap;true;of;(Class,Object);;Argument[1];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable;true;of;(Object,Object,Object);;Argument[0];SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable;true;of;(Object,Object,Object);;Argument[1];SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable;true;of;(Object,Object,Object);;Argument[2];MapValue of ReturnValue;value",
|
||||
// `copyOf` methods
|
||||
"com.google.common.collect;ImmutableList;true;copyOf;(Object[]);;ArrayElement of Argument[0];Element of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableList;true;copyOf;(Iterable);;Element of Argument[0];Element of ReturnValue;value",
|
||||
@@ -153,12 +196,16 @@ private class GuavaCollectCsv extends SummaryModelCsv {
|
||||
"com.google.common.collect;ImmutableMap;true;copyOf;(Iterable);;MapValue of Element of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableSortedMap;true;copyOfSorted;(SortedMap);;MapKey of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableSortedMap;true;copyOfSorted;(SortedMap);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableSortedMap;true;copyOf;(Map,Comparator);;MapKey of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableSortedMap;true;copyOf;(Map,Comparator);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableMultimap;true;copyOf;(Multimap);;MapKey of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableMultimap;true;copyOf;(Multimap);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableMultimap;true;copyOf;(Iterable);;MapKey of Element of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableMultimap;true;copyOf;(Iterable);;MapValue of Element of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableClassToInstanceMap;true;copyOf;(Map);;MapKey of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableClassToInstanceMap;true;copyOf;(Map);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable;true;copyOf;(Table);;MapKey of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ImmutableTable;true;copyOf;(Table);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
// `create` methods
|
||||
"com.google.common.collect;HashMultiset;true;create;(Iterable);;Element of Argument[0];Element of ReturnValue;value",
|
||||
"com.google.common.collect;LinkdHashMultiset;true;create;(Iterable);;Element of Argument[0];Element of ReturnValue;value",
|
||||
@@ -178,6 +225,12 @@ private class GuavaCollectCsv extends SummaryModelCsv {
|
||||
"com.google.common.collect;HashBiMap;true;create;(Map);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;MutableClassToInstanceMap;true;create;(Multimap);;MapKey of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;MutableClassToInstanceMap;true;create;(Multimap);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;HashBasedTable;true;create;(Table);;MapKey of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;HashBasedTable;true;create;(Table);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;TreeBasedTable;true;create;(Table);;MapKey of Argument[0];MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;TreeBasedTable;true;create;(Table);;MapValue of Argument[0];MapValue of ReturnValue;value",
|
||||
"com.google.common.collect;ArrayTable;true;create;(Iterable,Iterable);;Element of Argument[0];SyntheticField[com.google.common.collect.Table.rowKey] of MapKey of ReturnValue;value",
|
||||
"com.google.common.collect;ArrayTable;true;create;(Iterable,Iterable);;Element of Argument[1];SyntheticField[com.google.common.collect.Table.columnKey] of MapKey of ReturnValue;value"
|
||||
// Utility classes
|
||||
]
|
||||
}
|
||||
@@ -240,6 +293,22 @@ class TableType extends RefType {
|
||||
}
|
||||
}
|
||||
|
||||
private class TableRowField extends SyntheticField {
|
||||
override predicate fieldSpec(RefType owningType, string fieldName, Type fieldType) {
|
||||
owningType.hasQualifiedName(guavaCollectPackage(), "Table") and
|
||||
fieldName = "rowKey" and
|
||||
fieldType instanceof TypeObject
|
||||
}
|
||||
}
|
||||
|
||||
private class TableColumnField extends SyntheticField {
|
||||
override predicate fieldSpec(RefType owningType, string fieldName, Type fieldType) {
|
||||
owningType.hasQualifiedName(guavaCollectPackage(), "Table") and
|
||||
fieldName = "columnKey" and
|
||||
fieldType instanceof TypeObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A taint-preserving static method of `com.google.common.collect.Sets`.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.SortedMap;
|
||||
@@ -10,27 +11,61 @@ class TestCollect {
|
||||
|
||||
void sink(Object o) {}
|
||||
|
||||
<T> T element(Collection<T> c) {
|
||||
return c.iterator().next();
|
||||
}
|
||||
|
||||
<K,V> K mapKey(Map<K,V> m) {
|
||||
return element(m.keySet());
|
||||
}
|
||||
|
||||
<K,V> V mapValue(Map<K,V> m) {
|
||||
return element(m.values());
|
||||
}
|
||||
|
||||
<K,V> K multimapKey(Multimap<K,V> m) {
|
||||
return element(m.keySet());
|
||||
}
|
||||
|
||||
<K,V> V multimapValue(Multimap<K,V> m) {
|
||||
return element(m.values());
|
||||
}
|
||||
|
||||
<R,C,V> R tableRow(Table<R,C,V> t) {
|
||||
return element(t.rowKeySet());
|
||||
}
|
||||
|
||||
<R,C,V> C tableColumn(Table<R,C,V> t) {
|
||||
return element(t.columnKeySet());
|
||||
}
|
||||
|
||||
<R,C,V> V tableValue(Table<R,C,V> t) {
|
||||
return element(t.values());
|
||||
}
|
||||
|
||||
void test1() {
|
||||
String x = taint();
|
||||
|
||||
ImmutableSet<String> xs = ImmutableSet.of(x, "y", "z");
|
||||
sink(xs.asList().toArray()[0]); // $numValueFlow=1
|
||||
sink(element(xs.asList())); // $numValueFlow=1
|
||||
|
||||
ImmutableSet<String> ys = ImmutableSet.of("a", "b", "c");
|
||||
|
||||
sink(Sets.filter(Sets.union(xs, ys), y -> true).toArray()[0]); // $numValueFlow=1
|
||||
sink(element(Sets.filter(Sets.union(xs, ys), y -> true))); // $numTaintFlow=1
|
||||
|
||||
sink(Sets.newHashSet("a", "b", "c", "d", x)); // $numValueFlow=1
|
||||
sink(element(Sets.newHashSet("a", "b", "c", "d", x))); // $numTaintFlow=1
|
||||
}
|
||||
|
||||
void test2() {
|
||||
sink(ImmutableList.of(taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint()).toArray()[0]); // $numValueFlow=16
|
||||
sink(ImmutableSet.of(taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint()).toArray()[0]); // $numValueFlow=16
|
||||
sink(ImmutableMap.of(taint(), taint(), taint(), taint()).keys().toArray()[0]); // $numValueFlow=2
|
||||
sink(ImmutableMap.of(taint(), taint(), taint(), taint()).values().toArray()[0]); // $numValueFlow=2
|
||||
sink(ImmutableMultimap.of(taint(), taint(), taint(), taint()).keys().toArray()[0]); // $numValueFlow=2
|
||||
sink(ImmutableMultimap.of(taint(), taint(), taint(), taint()).values().toArray()[0]); // $numValueFlow=2
|
||||
sink(ImmutableTable.of(taint(),taint(), taint())); // $numValueFlow=1
|
||||
sink(element(ImmutableList.of(taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint()))); // $numValueFlow=16
|
||||
sink(element(ImmutableSet.of(taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint(),taint(), taint(), taint(), taint()))); // $numValueFlow=16
|
||||
sink(mapKey(ImmutableMap.of(taint(), taint(), taint(), taint()))); // $numValueFlow=2 SPURIOUS:numTaintFlow=4
|
||||
sink(mapValue(ImmutableMap.of(taint(), taint(), taint(), taint()))); // $numValueFlow=2
|
||||
sink(multimapKey(ImmutableMultimap.of(taint(), taint(), taint(), taint()))); // $numValueFlow=2 SPURIOUS:numTaintFlow=4
|
||||
sink(multimapValue(ImmutableMultimap.of(taint(), taint(), taint(), taint()))); // $numValueFlow=2
|
||||
sink(tableRow(ImmutableTable.of(taint(), taint(), taint()))); // $numValueFlow=1
|
||||
sink(tableColumn(ImmutableTable.of(taint(), taint(), taint()))); // $numValueFlow=1
|
||||
sink(tableValue(ImmutableTable.of(taint(), taint(), taint()))); // $numValueFlow=1
|
||||
}
|
||||
|
||||
void test3() {
|
||||
@@ -41,31 +76,32 @@ class TestCollect {
|
||||
b.add("a");
|
||||
sink(b);
|
||||
b.add(x);
|
||||
sink(b.build().toArray()[0]); // $numValueFlow=1
|
||||
sink(element(b.build())); // $numValueFlow=1
|
||||
|
||||
b = ImmutableList.builder();
|
||||
|
||||
b.add("a").add(x);
|
||||
sink(b.build().toArray()[0]); // $numValueFlow=1
|
||||
sink(element(b.build())); // $numValueFlow=1
|
||||
|
||||
sink(ImmutableList.builder().add("a").add(x).build().toArray()[0]); // $numValueFlow=1
|
||||
|
||||
ImmutableMap.Builder<String, String> b2 = ImmutableMap.builder();
|
||||
b2.put(x,"v");
|
||||
sink(b2);
|
||||
sink(mapKey(b2.build())); // $numValueFlow=1
|
||||
b2.put("k",x);
|
||||
sink(b2.build()); // $numValueFlow=1
|
||||
sink(mapValue(b2.build())); // $numValueFlow=1
|
||||
}
|
||||
|
||||
void test4(Table<String, String, String> t1, Table<String, String, String> t2, Table<String, String, String> t3) {
|
||||
String x = taint();
|
||||
t1.put(x, "c", "v");
|
||||
sink(t1);
|
||||
sink(tableRow(t1)); // $numValueFlow=1
|
||||
t1.put("r", x, "v");
|
||||
sink(t1);
|
||||
sink(tableColumn(t1)); // $numValueFlow=1
|
||||
t1.put("r", "c", x);
|
||||
sink(t1); // $numValueFlow=1
|
||||
sink(t1.row("r")); // $numValueFlow=1
|
||||
sink(tableValue(t1)); // $numValueFlow=1
|
||||
sink(mapKey(t1.row("r"))); // $numValueFlow=1
|
||||
sink(mapValue(t1.row("r"))); // $numValueFlow=1
|
||||
|
||||
t2.putAll(t1);
|
||||
for (Table.Cell<String,String,String> c : t2.cellSet()) {
|
||||
@@ -75,21 +111,21 @@ class TestCollect {
|
||||
sink(t1.remove("r", "c")); // $numValueFlow=1
|
||||
|
||||
t3.row("r").put("c", x);
|
||||
sink(t3); // $ MISSING:numValueFlow=1
|
||||
sink(tableValue(t3)); // $ MISSING:numValueFlow=1 // depends on aliasing
|
||||
}
|
||||
|
||||
void test4(Multimap<String, String> m1, Multimap<String, String> m2, Multimap<String, String> m3,
|
||||
Multimap<String, String> m4, Multimap<String, String> m5){
|
||||
String x = taint();
|
||||
m1.put("k", x);
|
||||
sink(m1); // $numValueFlow=1
|
||||
sink(m1.get("k")); // $numValueFlow=1
|
||||
sink(multimapValue(m1)); // $numValueFlow=1
|
||||
sink(element(m1.get("k"))); // $numValueFlow=1
|
||||
|
||||
m2.putAll("k", ImmutableList.of("a", x, "b"));
|
||||
sink(m2); // $numValueFlow=1
|
||||
sink(multimapValue(m2)); // $numValueFlow=1
|
||||
|
||||
m3.putAll(m1);
|
||||
sink(m3); // $numValueFlow=1
|
||||
sink(multimapValue(m3)); // $numValueFlow=1
|
||||
|
||||
m4.replaceValues("k", m1.replaceValues("k", ImmutableList.of("a")));
|
||||
for (Map.Entry<String, String> e : m4.entries()) {
|
||||
@@ -97,29 +133,29 @@ class TestCollect {
|
||||
}
|
||||
|
||||
m5.asMap().get("k").add(x);
|
||||
sink(m5); // $ MISSING:numValueFlow=1
|
||||
sink(multimapValue(m5)); // $ MISSING:numValueFlow=1 // depends on aliasing
|
||||
}
|
||||
|
||||
void test5(Comparator<String> comp, SortedSet<String> sorS, SortedMap<String, String> sorM) {
|
||||
ImmutableSortedSet<String> s = ImmutableSortedSet.of(taint());
|
||||
|
||||
sink(s.toArray()[0]); // $numValueFlow=1
|
||||
sink(ImmutableSortedSet.copyOf(s).toArray()[0]); // $numValueFlow=1
|
||||
sink(ImmutableSortedSet.copyOf(comp, s).toArray()[0]); // $numValueFlow=1
|
||||
sink(element(s)); // $numValueFlow=1
|
||||
sink(element(ImmutableSortedSet.copyOf(s))); // $numValueFlow=1
|
||||
sink(element(ImmutableSortedSet.copyOf(comp, s))); // $numValueFlow=1
|
||||
|
||||
sorS.add(taint());
|
||||
sink(ImmutableSortedSet.copyOfSorted(sorS)); // $ MISSING: numTaintFlow=1
|
||||
sink(element(ImmutableSortedSet.copyOfSorted(sorS))); // $numValueFlow=1
|
||||
|
||||
sink(ImmutableList.sortedCopyOf(s).toArray()[0]); // $numValueFlow=1
|
||||
sink(ImmutableList.sortedCopyOf(comp, s).toArray()[0]); // $numValueFlow=1
|
||||
sink(element(ImmutableList.sortedCopyOf(s))); // $numValueFlow=1
|
||||
sink(element(ImmutableList.sortedCopyOf(comp, s))); // $numValueFlow=1
|
||||
|
||||
ImmutableSortedMap<String, String> m = ImmutableSortedMap.of("k", taint());
|
||||
|
||||
sink(m); // $numValueFlow=1
|
||||
sink(ImmutableSortedMap.copyOf(m)); // $numValueFlow=1
|
||||
sink(ImmutableSortedMap.copyOf(m, comp)); // $numValueFlow=1
|
||||
sink(mapValue(m)); // $numValueFlow=1
|
||||
sink(mapValue(ImmutableSortedMap.copyOf(m))); // $numValueFlow=1
|
||||
sink(mapValue(ImmutableSortedMap.copyOf(m, comp))); // $numValueFlow=1
|
||||
|
||||
sorM.put("k", taint());
|
||||
sink(ImmutableSortedMap.copyOfSorted(sorM)); // $ MISSING: numTaintFlow=1
|
||||
sink(mapValue(ImmutableSortedMap.copyOfSorted(sorM))); // $numValueFlow=1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user