make examples better
MODIFY
examples/aflpp_driver/GNUmakefile
examples/aflpp_driver/GNUmakefile
@@ -9,19 +9,13 @@ endif
FLAGS=-O3 -funroll-loops
-all: libAFLDriver.a libAFLDriver2.a
+all: libAFLDriver.a
aflpp_driver.o: aflpp_driver.cpp
$(LLVM_BINDIR)clang++ $(FLAGS) -stdlib=libc++ -funroll-loops -std=c++11 -c aflpp_driver.cpp
-afl-llvm-rt.o: ../../llvm_mode/afl-llvm-rt.o.c
- $(LLVM_BINDIR)clang $(FLAGS) -I../../include -c -o afl-llvm-rt.o ../../llvm_mode/afl-llvm-rt.o.c
-
libAFLDriver.a: aflpp_driver.o
ar ru libAFLDriver.a aflpp_driver.o
-libAFLDriver2.a: aflpp_driver.o afl-llvm-rt.o
- ar ru libAFLDriver2.a aflpp_driver.o afl-llvm-rt.o
-
clean:
rm -f *.o libAFLDriver*.a *~ core

MODIFY
examples/persistent_demo/persistent_demo.c
examples/persistent_demo/persistent_demo.c
@@ -63,7 +63,7 @@ int main(int argc, char **argv) {
We just have some trivial inline code that faults on 'foo!'. */
/* do we have enough data? */
- if (len < 8) return 0;
+ if (len < 8) continue;
if (buf[0] == 'f') {

MODIFY
examples/persistent_demo/persistent_demo_new.c
examples/persistent_demo/persistent_demo_new.c
__AFL_FUZZ_INIT();
-unsigned int crc32_for_byte(unsigned int r) {
-
- for (int j = 0; j < 8; ++j)
- r = (r & 1 ? 0 : (unsigned int)0xEDB88320L) ^ r >> 1;
- return r ^ (unsigned int)0xFF000000L;
-
-}
-
-unsigned int crc32(unsigned char *data, unsigned int n_bytes) {
-
- static unsigned char table[0x100];
- unsigned int crc = 0;
- if (!*table)
- for (unsigned int i = 0; i < 0x100; ++i)
- table[i] = crc32_for_byte(i);
- for (unsigned int i = 0; i < n_bytes; ++i)
- crc = table[(unsigned char)crc ^ (data)[i]] ^ crc >> 8;
- return crc;
-
-}
-
/* Main entry point. */
int main(int argc, char **argv) {
@@ -70,7 +49,7 @@ int main(int argc, char **argv) {
len = __AFL_FUZZ_TESTCASE_LEN;
/* do we have enough data? */
- if (len < 8) return 0;
+ if (len < 8) continue;
if (buf[0] == 'f') {

MODIFY
llvm_mode/README.persistent_mode.md
llvm_mode/README.persistent_mode.md
@@ -32,8 +32,7 @@ main() {
while (__AFL_LOOP(10000)) {
int len = __AFL_FUZZ_TESTCASE_LEN;
-
- if (len < 8) return 0; // check for a required/useful minimum input length
+ if (len < 8) continue; // check for a required/useful minimum input length
/* Setup function call, e.g. struct target *tmp = libtarget_init() */
/* Call function to be fuzzed, e.g.: */

make examples better