• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stddef.h>
2 #include <stdint.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 
6 #include "fuzz_helpers.h"
7 #include "lz4frame.h"
8 #include "lz4hc.h"
9 
10 /* Struct used for maintaining the state of the data */
11 typedef struct FUZZ_dataProducer_s FUZZ_dataProducer_t;
12 
13 /* Returns a data producer state struct. Use for producer initialization. */
14 FUZZ_dataProducer_t *FUZZ_dataProducer_create(const uint8_t *data, size_t size);
15 
16 /* Frees the data producer */
17 void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer);
18 
19 /* Returns 32 bits from the end of data */
20 uint32_t FUZZ_dataProducer_retrieve32(FUZZ_dataProducer_t *producer);
21 
22 /* Returns value between [min, max] */
23 uint32_t FUZZ_getRange_from_uint32(uint32_t seed, uint32_t min, uint32_t max);
24 
25 /* Combination of above two functions for non adaptive use cases. ie where size is not involved */
26 uint32_t FUZZ_dataProducer_range32(FUZZ_dataProducer_t *producer, uint32_t min,
27                                   uint32_t max);
28 
29 /* Returns lz4 preferences */
30 LZ4F_preferences_t FUZZ_dataProducer_preferences(FUZZ_dataProducer_t* producer);
31 
32 /* Returns lz4 frame info */
33 LZ4F_frameInfo_t FUZZ_dataProducer_frameInfo(FUZZ_dataProducer_t* producer);
34 
35 /* Returns the size of the remaining bytes of data in the producer */
36 size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer);
37