ensure a valid seed exists

This commit is contained in:
vanhauser-thc
2021-02-22 16:39:38 +01:00
parent a252943236
commit 70fe872940
3 changed files with 10 additions and 2 deletions

View File

@ -1675,6 +1675,7 @@ void __cmplog_rtn_llvm_stdstring_cstring(u8 *stdstring, u8 *cstring) {
if (unlikely(!__afl_cmp_map)) return; if (unlikely(!__afl_cmp_map)) return;
if (!area_is_mapped(stdstring, 32) || !area_is_mapped(cstring, 32)) return; if (!area_is_mapped(stdstring, 32) || !area_is_mapped(cstring, 32)) return;
__cmplog_rtn_hook(get_llvm_stdstring(stdstring), cstring); __cmplog_rtn_hook(get_llvm_stdstring(stdstring), cstring);
} }
@ -1684,6 +1685,7 @@ void __cmplog_rtn_llvm_stdstring_stdstring(u8 *stdstring1, u8 *stdstring2) {
if (unlikely(!__afl_cmp_map)) return; if (unlikely(!__afl_cmp_map)) return;
if (!area_is_mapped(stdstring1, 32) || !area_is_mapped(stdstring2, 32)) if (!area_is_mapped(stdstring1, 32) || !area_is_mapped(stdstring2, 32))
return; return;
__cmplog_rtn_hook(get_llvm_stdstring(stdstring1), __cmplog_rtn_hook(get_llvm_stdstring(stdstring1),
get_llvm_stdstring(stdstring2)); get_llvm_stdstring(stdstring2));

View File

@ -1700,7 +1700,8 @@ int main(int argc, char **argv, char **envp) {
"selected.\n" "selected.\n"
"Read the documentation for FEATURES though, all are good but few are " "Read the documentation for FEATURES though, all are good but few are "
"defaults.\n" "defaults.\n"
"Recommended is afl-clang-lto with AFL_LLVM_CMPLOG or afl-clang-fast with\n" "Recommended is afl-clang-lto with AFL_LLVM_CMPLOG or afl-clang-fast "
"with\n"
"AFL_LLVM_CMPLOG and AFL_LLVM_DICT2FILE.\n\n"); "AFL_LLVM_CMPLOG and AFL_LLVM_DICT2FILE.\n\n");
exit(1); exit(1);

View File

@ -1707,7 +1707,12 @@ int main(int argc, char **argv_orig, char **envp) {
cull_queue(afl); cull_queue(afl);
if (!afl->pending_not_fuzzed) { // ensure we have at least one seed that is not disabled.
u32 entry, valid_seeds = 0;
for (entry = 0; entry < afl->queued_paths; ++entry)
if (!afl->queue_buf[entry]->disabled) { ++valid_seeds; }
if (!afl->pending_not_fuzzed || !valid_seeds) {
FATAL("We need at least one valid input seed that does not crash!"); FATAL("We need at least one valid input seed that does not crash!");