Skip to content

Commit 084e136

Browse files
authored
Merge pull request diffblue#318 from diffblue/bugfix/different_reason_for_xfail
SEC-171: Fix benchmark rule; note reason for test failure
2 parents 412dbb1 + 70089e7 commit 084e136

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

regression/end_to_end/tainted-user-class/subclass_rules.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"comment": "Taint source",
66
"id": "basic1_source",
77
"class": "subclass",
8-
"method": "source:()[Lsubclass;",
8+
"method": "source:()Lsubclass;",
99
"result": {
1010
"location": "return_value",
1111
"taint": "XXX"

regression/end_to_end/tainted-user-class/test_tainted_user_class.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import run_security_analyser_pipeline
44

55
import os.path
6+
import pytest
67

78
def test_user_class():
89
traces = run_security_analyser_pipeline(
@@ -12,12 +13,17 @@ def test_user_class():
1213
assert traces.count_traces() > 0
1314
assert traces.trace_exists("java::test.main:(I)V", 16)
1415

16+
@pytest.mark.xfail(strict=True)
1517
def test_user_subclass():
16-
# The current behaviour may not be what we want, but this verifies if
17-
# it has changed: taint assigned to a subtype and taint cleared / read
18-
# from a supertype are currently *always distinct*.
18+
"""
19+
The issue is the instrumentation; Although the taint var is here
20+
struct subclass { struct test @test; _Bool @__CPROVER_XXX; }
21+
However, the sink test looks like this
22+
IF !((struct test *)anonlocal::3a)->@__CPROVER_XXX THEN GOTO 5
23+
"""
1924
traces = run_security_analyser_pipeline(
2025
"subclass.class",
2126
"subclass_rules.json",
2227
os.path.realpath(os.path.dirname(__file__)))
23-
assert traces.count_traces() == 0
28+
assert traces.count_traces() == 1
29+
assert traces.trace_exists("java::subclass.main:(I)V", 14)

0 commit comments

Comments
 (0)