hunting ref underflow

This commit is contained in:
Dominik Maier
2020-10-06 16:45:25 +02:00
parent 4f207b4eba
commit 2d5fadc1e6
2 changed files with 9 additions and 5 deletions

View File

@ -837,10 +837,17 @@ u8 *queue_testcase_take(afl_state_t *afl, struct queue_entry *q) {
}
q->testcase_refs++;
if (!q->testcase_buf) {
if (unlikely(!q->testcase_buf || !q->testcase_refs)) {
if (!q->testcase_buf) {
FATAL("Testcase buf is NULL, this should never happen");
FATAL("Testcase buf is NULL, this should never happen");
}
if (!q->testcase_refs) {
FATAL("Testcase ref overflow. Missing a testcase release somwhere?");
}
}
return q->testcase_buf;