--------------------------------------------------------------------------- 1. Core regression: task immediately after the deleted task must still run. Chain: A -> B -> C. A deletes B. C must execute. ---------------------------------------------------------------------------
| 100 | // Chain: A -> B -> C. A deletes B. C must execute. |
| 101 | // --------------------------------------------------------------------------- |
| 102 | TEST_F(UafRegressionTest, TaskAfterDeletedTaskStillRuns) { |
| 103 | Scheduler ts; |
| 104 | |
| 105 | Task taskA(TASK_IMMEDIATE, TASK_ONCE, cbA_delete_one, &ts, true); |
| 106 | s_victim1 = new Task(TASK_IMMEDIATE, TASK_ONCE, cbB, &ts, true); |
| 107 | Task taskC(TASK_IMMEDIATE, TASK_ONCE, cbC, &ts, true); |
| 108 | |
| 109 | ts.execute(); |
| 110 | |
| 111 | EXPECT_EQ(s_a_count, 1) << "Task A should have run"; |
| 112 | EXPECT_EQ(s_b_count, 0) << "Task B was deleted by A before it could run"; |
| 113 | EXPECT_EQ(s_c_count, 1) << "Task C must run despite B being deleted mid-iteration"; |
| 114 | } |
| 115 | |
| 116 | // --------------------------------------------------------------------------- |
| 117 | // 2. All tasks beyond the deleted node must run in the same pass. |