Java: Reveal false negative in test

One of the sinks was flagged for the wrong reason in the test case.

The flow into the 'startActivities' sink isn't working properly, but this was not revealed by the test since an alternate, spurious path exists. The spurious path goes through the implicit read at the prior sink and takes a use-use step to the 'startActivities' sink. Swapping the order of the two sinks reveals the false negative.
This commit is contained in:
Asger F
2024-08-21 13:36:47 +02:00
parent 993bfee096
commit 5751fc2d3a
2 changed files with 2 additions and 1 deletions

View File

@@ -1,2 +1,3 @@
failures
testFailures
| ImplicitPendingIntentsTest.java:35:60:35:87 | // $hasImplicitPendingIntent | Missing result:hasImplicitPendingIntent= |

View File

@@ -32,8 +32,8 @@ public class ImplicitPendingIntentsTest {
PendingIntent pi = PendingIntent.getActivity(ctx, 0, baseIntent, 0);
Intent fwdIntent = new Intent();
fwdIntent.putExtra("fwdIntent", pi);
ctx.startActivity(fwdIntent); // $hasImplicitPendingIntent
ctx.startActivities(new Intent[] {fwdIntent}); // $hasImplicitPendingIntent
ctx.startActivity(fwdIntent); // $hasImplicitPendingIntent
ctx.startService(fwdIntent); // Safe
ctx.sendBroadcast(fwdIntent); // $hasImplicitPendingIntent