mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 02:58:08 +00:00
added better error handling to forkserver fd
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -76,3 +76,8 @@ examples/afl_frida/afl-frida
|
|||||||
examples/afl_frida/libtestinstr.so
|
examples/afl_frida/libtestinstr.so
|
||||||
examples/afl_frida/frida-gum-example.c
|
examples/afl_frida/frida-gum-example.c
|
||||||
examples/afl_frida/frida-gum.h
|
examples/afl_frida/frida-gum.h
|
||||||
|
examples/aflpp_driver/libAFLDriver.a
|
||||||
|
examples/aflpp_driver/libAFLQemuDriver.a
|
||||||
|
libAFLDriver.a
|
||||||
|
libAFLQemuDriver.a
|
||||||
|
test/.afl_performance
|
@ -273,13 +273,15 @@
|
|||||||
/* Error-checking versions of read() and write() that call RPFATAL() as
|
/* Error-checking versions of read() and write() that call RPFATAL() as
|
||||||
appropriate. */
|
appropriate. */
|
||||||
|
|
||||||
#define ck_write(fd, buf, len, fn) \
|
#define ck_write(fd, buf, len, fn) \
|
||||||
do { \
|
do { \
|
||||||
\
|
\
|
||||||
s32 _len = (s32)(len); \
|
int _fd = (fd); \
|
||||||
s32 _res = write(fd, buf, _len); \
|
\
|
||||||
if (_res != _len) RPFATAL(_res, "Short write to %s", fn); \
|
s32 _len = (s32)(len); \
|
||||||
\
|
s32 _res = write(_fd, (buf), _len); \
|
||||||
|
if (_res != _len) RPFATAL(_res, "Short write to %s, fd %d", fn, _fd); \
|
||||||
|
\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ck_read(fd, buf, len, fn) \
|
#define ck_read(fd, buf, len, fn) \
|
||||||
|
@ -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); }
|
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.
|
// 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)");
|
FATAL(
|
||||||
|
"Nowhere to write output to (neither out_fd nor out_file set (fd is "
|
||||||
|
"%d))",
|
||||||
|
fd);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user