Скомпилировано с afl-gcc - инструментарий не обнаружен

Я хочу фаззить мое приложение с помощью afl, но после замены gcc с afl-gcc Я все еще получаю ошибку: [-] PROGRAM ABORT : No instrumentation detected.

Я создал простую программу на C для устранения проблемы:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

static int do_stuff(int fd) {
    char buffer[3];
    read(fd, buffer, sizeof(buffer));

    int size = atoi(buffer);

    char* str = malloc(size);

    read(fd, str, size);

    printf("'%s'\n", str);

    free(str);

    return 0;
}

int main(int argc, char** argv) {
    if (argc < 2)
        return 1;

    int fd = open(argv[1], O_RDONLY);

    if (fd < 0)
        return 2;

    int ret = do_stuff(fd);

    close(fd);

    return ret;
}

Я собираю это с afl-gcc main.c -o main, В качестве входного файла я использую echo "12 Hello World.foobar" > foo.txt

Когда я сейчас бегу afl-analyze -i foo.txt ./main я получил

afl-analyze 2.52b by <lcamtuf@google.com>

[+] Read 22 bytes from 'foo.txt'.
[*] Performing dry run (mem limit = 50 MB, timeout = 1000 ms)...

[-] PROGRAM ABORT : No instrumentation detected.
         Location : main(), afl-analyze.c:1068

Я что-то пропустил? Я установил afl (2.52b-2) прямо из репозиториев Ubuntu (18.04).

1 ответ

Вероятно, предел памяти слишком низкий. Попробуйте установить больший объем памяти или установить его как нет.

afl-analyze -m none -i foo.txt ./main
Другие вопросы по тегам