add cmplog icmp testcase to CI

This commit is contained in:
vanhauser-thc 2022-04-06 10:10:10 +02:00
parent 9887f636ba
commit 3c5edab724
2 changed files with 6 additions and 4 deletions

View File

@ -8,13 +8,15 @@
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t i) {
if (i < 24) return 0;
if (i < 30) return 0;
if (buf[0] != 'A') return 0;
if (buf[1] != 'B') return 0;
if (buf[2] != 'C') return 0;
if (buf[3] != 'D') return 0;
if (memcmp(buf + 4, "1234", 4) || memcmp(buf + 8, "EFGH", 4)) return 0;
if (strncmp(buf + 12, "IJKL", 4) == 0 && strcmp(buf + 16, "DEADBEEF") == 0)
int *icmp = (int *)(buf + 4);
if (*icmp != 0x69694141) return 0;
if (memcmp(buf + 8, "1234", 4) || memcmp(buf + 12, "EFGH", 4)) return 0;
if (strncmp(buf + 16, "IJKL", 4) == 0 && strcmp(buf + 20, "DEADBEEF") == 0)
abort();
return 0;

View File

@ -261,7 +261,7 @@ test -e ../afl-clang-fast -a -e ../split-switches-pass.so && {
$ECHO "$GREY[*] running afl-fuzz for llvm_mode cmplog, this will take approx 10 seconds"
{
mkdir -p in
echo 0000000000000000000000000 > in/in
echo 00000000000000000000000000000000 > in/in
AFL_BENCH_UNTIL_CRASH=1 ../afl-fuzz -m none -V60 -i in -o out -c./test-cmplog -- ./test-cmplog >>errors 2>&1
} >>errors 2>&1
test -n "$( ls out/default/crashes/id:000000* out/default/hangs/id:000000* 2>/dev/null )" & {