fixed scan-build warnings

This commit is contained in:
Dominik Maier
2021-03-10 01:15:38 +01:00
parent f21a5c42c1
commit 851231c846
3 changed files with 10 additions and 7 deletions

View File

@ -1693,7 +1693,8 @@ int main(int argc, char **argv, char **envp) {
" AFL_DONT_OPTIMIZE: disable optimization instead of -O3\n" " AFL_DONT_OPTIMIZE: disable optimization instead of -O3\n"
" AFL_NO_BUILTIN: no builtins for string compare functions (for " " AFL_NO_BUILTIN: no builtins for string compare functions (for "
"libtokencap.so)\n" "libtokencap.so)\n"
" AFL_NOOP: behave like a normal compiler (to pass configure tests)\n" " AFL_NOOP: behave like a normal compiler (to pass configure "
"tests)\n"
" AFL_PATH: path to instrumenting pass and runtime " " AFL_PATH: path to instrumenting pass and runtime "
"(afl-compiler-rt.*o)\n" "(afl-compiler-rt.*o)\n"
" AFL_IGNORE_UNKNOWN_ENVS: don't warn on unknown env vars\n" " AFL_IGNORE_UNKNOWN_ENVS: don't warn on unknown env vars\n"

View File

@ -828,7 +828,7 @@ void perform_dry_run(afl_state_t *afl) {
for (idx = 0; idx < afl->queued_paths; idx++) { for (idx = 0; idx < afl->queued_paths; idx++) {
q = afl->queue_buf[idx]; q = afl->queue_buf[idx];
if (unlikely(q->disabled)) { continue; } if (unlikely(!q || q->disabled)) { continue; }
u8 res; u8 res;
s32 fd; s32 fd;
@ -1069,7 +1069,7 @@ void perform_dry_run(afl_state_t *afl) {
} }
afl->max_depth = 0; afl->max_depth = 0;
for (i = 0; i < afl->queued_paths; i++) { for (i = 0; i < afl->queued_paths && likely(afl->queue_buf[i]); i++) {
if (!afl->queue_buf[i]->disabled && if (!afl->queue_buf[i]->disabled &&
afl->queue_buf[i]->depth > afl->max_depth) afl->queue_buf[i]->depth > afl->max_depth)
@ -1136,10 +1136,11 @@ void perform_dry_run(afl_state_t *afl) {
for (idx = 0; idx < afl->queued_paths; idx++) { for (idx = 0; idx < afl->queued_paths; idx++) {
q = afl->queue_buf[idx]; q = afl->queue_buf[idx];
if (q->disabled || q->cal_failed || !q->exec_cksum) { continue; } if (!q || q->disabled || q->cal_failed || !q->exec_cksum) { continue; }
u32 done = 0; u32 done = 0;
for (i = idx + 1; i < afl->queued_paths && !done; i++) { for (i = idx + 1;
i < afl->queued_paths && !done && likely(afl->queue_buf[i]); i++) {
struct queue_entry *p = afl->queue_buf[i]; struct queue_entry *p = afl->queue_buf[i];
if (p->disabled || p->cal_failed || !p->exec_cksum) { continue; } if (p->disabled || p->cal_failed || !p->exec_cksum) { continue; }
@ -1191,7 +1192,7 @@ void perform_dry_run(afl_state_t *afl) {
for (idx = 0; idx < afl->queued_paths; idx++) { for (idx = 0; idx < afl->queued_paths; idx++) {
if (!afl->queue_buf[idx]->disabled && if (afl->queue_buf[idx] && !afl->queue_buf[idx]->disabled &&
afl->queue_buf[idx]->depth > afl->max_depth) afl->queue_buf[idx]->depth > afl->max_depth)
afl->max_depth = afl->queue_buf[idx]->depth; afl->max_depth = afl->queue_buf[idx]->depth;
@ -1247,7 +1248,7 @@ void pivot_inputs(afl_state_t *afl) {
ACTF("Creating hard links for all input files..."); ACTF("Creating hard links for all input files...");
for (i = 0; i < afl->queued_paths; i++) { for (i = 0; i < afl->queued_paths && likely(afl->queue_buf[i]); i++) {
q = afl->queue_buf[i]; q = afl->queue_buf[i];

View File

@ -1409,6 +1409,7 @@ int main(int argc, char **argv_orig, char **envp) {
WARNF("general thread priority settings failed"); WARNF("general thread priority settings failed");
} }
#endif #endif
init_count_class16(); init_count_class16();