Skip to content

Commit

Permalink
Merge pull request #15855 from yoff/python/add-MaD-test-tuple-output
Browse files Browse the repository at this point in the history
Python: Add test for `ReturnValue.TupleElement[n]`
  • Loading branch information
RasmusWL authored Mar 11, 2024
2 parents 73c4fe0 + 6d8d106 commit 4ac8dd7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ extensions:
- ["foo", "Member[MS_append_to_list]", "Argument[1]", "ReturnValue.ListElement", "value"]
- ["foo", "Member[MS_append_to_list]", "Argument[0]", "ReturnValue", "taint"]
- ["foo", "Member[MS_append_to_list]", "Argument[1]", "ReturnValue", "taint"]
- ["foo", "Member[MS_spread]", "Argument[0]", "ReturnValue.TupleElement[0]", "value"]
- ["foo", "Member[MS_spread]", "Argument[1]", "ReturnValue.TupleElement[1]", "value"]
- ["json", "Member[MS_loads]", "Argument[0]", "ReturnValue", "taint"]
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ extensions:
- ["foo", "Member[MS_append_to_list]", "Argument[1]", "ReturnValue.ListElement", "value"]
- ["foo", "Member[MS_append_to_list]", "Argument[0]", "ReturnValue", "taint"]
- ["foo", "Member[MS_append_to_list]", "Argument[1]", "ReturnValue", "taint"]
- ["foo", "Member[MS_spread]", "Argument[0]", "ReturnValue.TupleElement[0]", "value"]
- ["foo", "Member[MS_spread]", "Argument[1]", "ReturnValue.TupleElement[1]", "value"]
- ["json", "Member[MS_loads]", "Argument[0]", "ReturnValue", "taint"]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def SINK_F(x):
ensure_tainted = ensure_not_tainted = print
TAINTED_STRING = "TAINTED_STRING"

from foo import MS_identity, MS_apply_lambda, MS_reversed, MS_list_map, MS_append_to_list
from foo import MS_identity, MS_apply_lambda, MS_reversed, MS_list_map, MS_append_to_list, MS_spread

# Simple summary
via_identity = MS_identity(SOURCE)
Expand Down Expand Up @@ -107,6 +107,13 @@ def explicit_identity(x):
tainted_list[0], # $ tainted
)

a, b = MS_spread(SOURCE, NONSOURCE)
SINK(a) # $ flow="SOURCE, l:-1 -> a"
SINK_F(b)
x, y = MS_spread(NONSOURCE, SOURCE)
SINK_F(x)
SINK(y) # $ flow="SOURCE, l:-2 -> y"

# Modeled flow-summary is not value preserving
from json import MS_loads as json_loads

Expand Down

0 comments on commit 4ac8dd7

Please sign in to comment.