Skip to content

Commit 0441098

Browse files
committed
Amend models of MultiValueMap.addAll overloads
1 parent b202110 commit 0441098

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

java/ql/src/semmle/code/java/frameworks/spring/SpringUtil.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ private class FlowSummaries extends SummaryModelCsv {
5858
"org.springframework.util;LinkedMultiValueMap;false;deepCopy;;;MapValue of Argument[-1];MapValue of ReturnValue;value",
5959
"org.springframework.util;MultiValueMap;true;add;;;Argument[0];MapKey of Argument[-1];value",
6060
"org.springframework.util;MultiValueMap;true;add;;;Argument[1];Element of MapValue of Argument[-1];value",
61-
"org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value",
61+
"org.springframework.util;MultiValueMap;true;addAll;(java.lang.Object,java.util.List);;Argument[0];MapKey of Argument[-1];value",
6262
"org.springframework.util;MultiValueMap;true;addAll;(java.lang.Object,java.util.List);;Element of Argument[1];Element of MapValue of Argument[-1];value",
63+
"org.springframework.util;MultiValueMap;true;addAll;(org.springframework.util.MultiValueMap);;MapKey of Argument[0];MapKey of Argument[-1];value",
6364
"org.springframework.util;MultiValueMap;true;addAll;(org.springframework.util.MultiValueMap);;Element of MapValue of Argument[0];Element of MapValue of Argument[-1];value",
6465
"org.springframework.util;MultiValueMap;true;addIfAbsent;;;Argument[0];MapKey of Argument[-1];value",
6566
"org.springframework.util;MultiValueMap;true;addIfAbsent;;;Argument[1];Element of MapValue of Argument[-1];value",

java/ql/test/library-tests/frameworks/spring/util/Test.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -536,32 +536,27 @@ public void test() throws Exception {
536536
out.addAll(in, null);
537537
sink(getMapKey(out)); // $hasValueFlow
538538
}
539-
{
540-
// "org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value"
541-
MultiValueMapAdapter out = null;
542-
MultiValueMap in = (MultiValueMap)source();
543-
out.addAll(in);
544-
sink(getMapKey(out)); // $hasValueFlow
545-
}
546539
{
547540
// "org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value"
548541
MultiValueMap out = null;
549542
Object in = (Object)source();
550-
out.addAll(in, null);
543+
out.addAll(in, (List)null);
551544
sink(getMapKey(out)); // $hasValueFlow
552545
}
553546
{
554547
// "org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value"
555-
MultiValueMap out = null;
556-
Object in = (Object)source();
557-
out.addAll(in, (List)null);
548+
MultiValueMapAdapter out = null;
549+
MultiValueMap<Object, Object> mvm = null;
550+
mvm.set(source(), "someValue");
551+
out.addAll(mvm);
558552
sink(getMapKey(out)); // $hasValueFlow
559553
}
560554
{
561555
// "org.springframework.util;MultiValueMap;true;addAll;;;Argument[0];MapKey of Argument[-1];value"
562556
MultiValueMap out = null;
563-
MultiValueMap in = (MultiValueMap)source();
564-
out.addAll(in);
557+
MultiValueMap<Object, Object> mvm = null;
558+
mvm.set(source(), "someValue");
559+
out.addAll(mvm);
565560
sink(getMapKey(out)); // $hasValueFlow
566561
}
567562
{

0 commit comments

Comments
 (0)