Skip to content

Commit

Permalink
Fix possible double-free in CFT tests (#240)
Browse files Browse the repository at this point in the history
In the event there are more operands than test results, the test should fail, not crash.
  • Loading branch information
hainest authored Dec 5, 2024
1 parent 38e5dfc commit 70d09bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/instruction/aarch64_cft.C
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ test_results_t aarch64_cft_Mutator::executeTest()
logerror("FAILED: instruction %s expected CFT, wasn't present", decodedInsns.front().format().c_str());
retVal = failure_accumulator(retVal, FAILED);
}
cfts.pop_front();
if(!cfts.empty()) {
cfts.pop_front();
}
}

decodedInsns.pop_front();
Expand Down
4 changes: 3 additions & 1 deletion src/instruction/power_cft.C
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ test_results_t power_cft_Mutator::executeTest()
logerror("FAILED: instruction %s expected CFT, wasn't present", decodedInsns.front().format().c_str());
retVal = failure_accumulator(retVal, FAILED);
}
cfts.pop_front();
if(!cfts.empty()) {
cfts.pop_front();
}
}

decodedInsns.pop_front();
Expand Down

0 comments on commit 70d09bc

Please sign in to comment.