Ruby: simplify Hash#transform_keys! flow summary

This commit is contained in:
Harry Maclean
2022-10-20 18:14:42 +13:00
parent 3c7f7511be
commit 0a4a8516eb
3 changed files with 707 additions and 696 deletions

View File

@@ -474,9 +474,6 @@ private class TransformKeysBangSummary extends SimpleSummarizedCallable {
(
input = "Argument[self].Element[any]" and
output = "Argument[self].Element[?]"
or
input = "Argument[self].WithoutElement[any]" and
output = "Argument[self]"
) and
preservesValue = true
}

View File

@@ -628,19 +628,21 @@ end
m38()
def m39()
def m39(x)
hash = {
:a => taint(39.1),
:b => 1,
:c => taint(39.2)
}
hash[x] = taint(39.3)
hash.transform_keys! {|key| key.to_s }
sink (hash["a"]) # $ hasValueFlow=39.1 $ hasValueFlow=39.2
sink (hash["b"]) # $ hasValueFlow=39.1 $ hasValueFlow=39.2
sink (hash["c"]) # $ hasValueFlow=39.1 $ hasValueFlow=39.2
sink (hash["a"]) # $ hasValueFlow=39.1 $ hasValueFlow=39.2 $ hasValueFlow=39.3
sink (hash["b"]) # $ hasValueFlow=39.1 $ hasValueFlow=39.2 $ hasValueFlow=39.3
sink (hash["c"]) # $ hasValueFlow=39.1 $ hasValueFlow=39.2 $ hasValueFlow=39.3
end
m39()
m39(:d)
def m40()
hash = {