about summary refs log tree commit diff
path: root/test/test-floatingpoint.c
blob: acecd55a5edd5b20dec9623b7f63a2bba16d39d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <stdint.h>

__AFL_FUZZ_INIT();

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;

}