diff options
author | van Hauser <vh@thc.org> | 2020-07-25 16:39:36 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2020-07-25 16:39:36 +0200 |
commit | 131df8bec9dc9dd7cf7a1c03d7189ba72580f6ab (patch) | |
tree | a2bb72225f7695b464c1f2ad32dbaa5334abfc64 /test/test-floatingpoint.c | |
parent | 79598083849b34bf33c4a6c904e69c2743151082 (diff) | |
download | afl++-131df8bec9dc9dd7cf7a1c03d7189ba72580f6ab.tar.gz |
try to fix travis
Diffstat (limited to 'test/test-floatingpoint.c')
-rw-r--r-- | test/test-floatingpoint.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/test/test-floatingpoint.c b/test/test-floatingpoint.c index 8f691c2c..083f0df5 100644 --- a/test/test-floatingpoint.c +++ b/test/test-floatingpoint.c @@ -1,17 +1,23 @@ #include <stdlib.h> #include <unistd.h> +#include <limits.h> +#include <stdint.h> -int main(void) { - - float magic; +__AFL_FUZZ_INIT(); - ssize_t bytes_read = read(STDIN_FILENO, &magic, sizeof(magic)); - if (bytes_read < (ssize_t)sizeof(magic)) { return 1; } - - if ((-magic == 15.0 + 0.5 + 0.125 + 0.03125 + - 0.0078125)) { /* 15 + 1/2 + 1/8 + 1/32 + 1/128 */ - abort(); +int main(void) { + ssize_t bytes_read; + + __AFL_INIT(); + float *magic = (float*)__AFL_FUZZ_TESTCASE_BUF; + + while (__AFL_LOOP(INT_MAX)) { + + if (__AFL_FUZZ_TESTCASE_LEN != sizeof(float)) return 1; + /* 15 + 1/2 + 1/8 + 1/32 + 1/128 */ + if ((-*magic == 15.0 + 0.5 + 0.125 + 0.03125 + 0.0078125)) abort(); + } return 0; |