added better error handling to forkserver fd
MODIFY
.gitignore
.gitignore
@@ -76,3 +76,8 @@ examples/afl_frida/afl-frida
examples/afl_frida/libtestinstr.so
examples/afl_frida/frida-gum-example.c
examples/afl_frida/frida-gum.h
+examples/aflpp_driver/libAFLDriver.a
+examples/aflpp_driver/libAFLQemuDriver.a
+libAFLDriver.a
+libAFLQemuDriver.a
+test/.afl_performance
\ No newline at end of file

MODIFY
include/debug.h
include/debug.h
#define ck_write(fd, buf, len, fn) \
do { \
\
+ int _fd = (fd); \
+ \
s32 _len = (s32)(len); \
- s32 _res = write(fd, buf, _len); \
- if (_res != _len) RPFATAL(_res, "Short write to %s", fn); \
+ s32 _res = write(_fd, (buf), _len); \
+ if (_res != _len) RPFATAL(_res, "Short write to %s, fd %d", fn, _fd); \
\
} while (0)

MODIFY
src/afl-forkserver.c
src/afl-forkserver.c
@@ -983,10 +983,13 @@ void afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
if (fd < 0) { PFATAL("Unable to create '%s'", fsrv->out_file); }
- } else if (unlikely(!fd)) {
+ } else if (unlikely(fd <= 0)) {
- // We should never have stdin as fd here, 0 is likely unset.
- FATAL("Nowhere to write output to (neither out_fd nor out_file set)");
+ // We should have a (non-stdin) fd at this point, else we got a problem.
+ FATAL(
+ "Nowhere to write output to (neither out_fd nor out_file set (fd is "
+ "%d))",
+ fd);
} else {

added better error handling to forkserver fd