summaryrefslogtreecommitdiff
path: root/fuzz/mutator_aux.h
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/mutator_aux.h')
-rw-r--r--fuzz/mutator_aux.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/fuzz/mutator_aux.h b/fuzz/mutator_aux.h
index 687f130..d14e177 100644
--- a/fuzz/mutator_aux.h
+++ b/fuzz/mutator_aux.h
@@ -7,6 +7,9 @@
7#ifndef _MUTATOR_AUX_H 7#ifndef _MUTATOR_AUX_H
8#define _MUTATOR_AUX_H 8#define _MUTATOR_AUX_H
9 9
10#include <stddef.h>
11#include <stdint.h>
12
10/* 13/*
11 * As of LLVM 7.0.1, MSAN support in libFuzzer was still experimental. 14 * As of LLVM 7.0.1, MSAN support in libFuzzer was still experimental.
12 * We therefore have to be careful when using our custom mutator, or 15 * We therefore have to be careful when using our custom mutator, or
@@ -31,6 +34,9 @@
31#define MAXSTR 1024 34#define MAXSTR 1024
32#define MAXBLOB 3072 35#define MAXBLOB 3072
33 36
37#define GETLEN_MIN 0
38#define GETLEN_MAX 1
39
34struct blob { 40struct blob {
35 uint8_t body[MAXBLOB]; 41 uint8_t body[MAXBLOB];
36 size_t len; 42 size_t len;
@@ -38,6 +44,7 @@ struct blob {
38 44
39size_t xstrlen(const char *); 45size_t xstrlen(const char *);
40void consume(const void *, size_t); 46void consume(const void *, size_t);
47void consume_str(const char *);
41 48
42int unpack_blob(uint8_t, uint8_t **, size_t *, struct blob *); 49int unpack_blob(uint8_t, uint8_t **, size_t *, struct blob *);
43int unpack_byte(uint8_t, uint8_t **, size_t *, uint8_t *); 50int unpack_byte(uint8_t, uint8_t **, size_t *, uint8_t *);
@@ -49,6 +56,11 @@ int pack_byte(uint8_t, uint8_t **, size_t *, uint8_t);
49int pack_int(uint8_t, uint8_t **, size_t *, int); 56int pack_int(uint8_t, uint8_t **, size_t *, int);
50int pack_string(uint8_t, uint8_t **, size_t *, const char *); 57int pack_string(uint8_t, uint8_t **, size_t *, const char *);
51 58
59size_t len_int(void);
60size_t len_string(int);
61size_t len_byte(void);
62size_t len_blob(int);
63
52void mutate_byte(uint8_t *); 64void mutate_byte(uint8_t *);
53void mutate_int(int *); 65void mutate_int(int *);
54void mutate_blob(struct blob *); 66void mutate_blob(struct blob *);
@@ -60,6 +72,9 @@ void set_wire_data(uint8_t *, size_t);
60int dev_read(void *, unsigned char *, size_t, int); 72int dev_read(void *, unsigned char *, size_t, int);
61int dev_write(void *, const unsigned char *, size_t); 73int dev_write(void *, const unsigned char *, size_t);
62 74
75void prng_init(unsigned long);
76unsigned long prng_uint32(void);
77
63uint32_t uniform_random(uint32_t); 78uint32_t uniform_random(uint32_t);
64 79
65#endif /* !_MUTATOR_AUX_H */ 80#endif /* !_MUTATOR_AUX_H */