Classes | Macros | Typedefs | Functions
curl_fuzzer.h File Reference
#include <curl/curl.h>
#include <testinput.h>
Include dependency graph for curl_fuzzer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fuzz_data
 Data local to a fuzzing run. More...
 
struct  fuzz_parse_state
 Internal state when parsing a TLV data stream. More...
 
struct  tlv
 
struct  tlv_raw
 Byte stream representation of the TLV header. More...
 

Macros

#define FCHECK(COND)
 
#define FTRY(FUNC)
 
#define TEMP_WRITE_ARRAY_SIZE   10
 
#define TLV_RC_NO_ERROR   0
 TLV function return codes. More...
 
#define TLV_RC_NO_MORE_TLVS   1
 
#define TLV_RC_SIZE_ERROR   2
 
#define TLV_TYPE_COOKIE   7
 
#define TLV_TYPE_CUSTOMREQUEST   10
 
#define TLV_TYPE_HEADER   6
 
#define TLV_TYPE_MAIL_FROM   12
 
#define TLV_TYPE_MAIL_RECIPIENT   11
 
#define TLV_TYPE_PASSWORD   4
 
#define TLV_TYPE_POSTFIELDS   5
 
#define TLV_TYPE_RANGE   9
 
#define TLV_TYPE_RESPONSE1   2
 
#define TLV_TYPE_UPLOAD1   8
 
#define TLV_TYPE_URL   1
 TLV types. More...
 
#define TLV_TYPE_USERNAME   3
 

Typedefs

typedef struct fuzz_data FUZZ_DATA
 Data local to a fuzzing run. More...
 
typedef struct fuzz_parse_state FUZZ_PARSE_STATE
 Internal state when parsing a TLV data stream. More...
 
typedef struct tlv TLV
 
typedef struct tlv_raw TLV_RAW
 Byte stream representation of the TLV header. More...
 

Functions

void fuzz_free (void **ptr)
 If a pointer has been allocated, free that pointer. More...
 
int fuzz_get_first_tlv (FUZZ_DATA *fuzz, TLV *tlv)
 TLV access function - gets the first TLV from a data stream. More...
 
int fuzz_get_next_tlv (FUZZ_DATA *fuzz, TLV *tlv)
 TLV access function - gets the next TLV from a data stream. More...
 
int fuzz_get_tlv_comn (FUZZ_DATA *fuzz, TLV *tlv)
 Common TLV function for accessing TLVs in a data stream. More...
 
int fuzz_initialize_fuzz_data (FUZZ_DATA *fuzz, const uint8_t *data, size_t data_len)
 Initialize the local fuzz data structure. More...
 
static curl_socket_t fuzz_open_socket (void *ptr, curlsocktype purpose, struct curl_sockaddr *address)
 
int fuzz_parse_tlv (FUZZ_DATA *fuzz, TLV *tlv)
 Do different actions on the CURL handle for different received TLVs. More...
 
static size_t fuzz_read_callback (char *buffer, size_t size, size_t nitems, void *ptr)
 
static int fuzz_sockopt_callback (void *ptr, curl_socket_t curlfd, curlsocktype purpose)
 
void fuzz_terminate_fuzz_data (FUZZ_DATA *fuzz)
 Terminate the fuzz data structure, including freeing any allocated memory. More...
 
char * fuzz_tlv_to_string (TLV *tlv)
 Converts a TLV data and length into an allocated string. More...
 
static size_t fuzz_write_callback (void *contents, size_t size, size_t nmemb, void *ptr)
 
uint16_t to_u16 (uint8_t b[2])
 Utility function to convert 2 bytes to a u16 predictably. More...
 
uint32_t to_u32 (uint8_t b[4])
 Utility function to convert 4 bytes to a u32 predictably. More...
 

Macro Definition Documentation

#define FCHECK (   COND)
Value:
{ \
if (!(COND)) \
{ \
rc = 255; \
goto EXIT_LABEL; \
} \
}
if(strcmp(arg,"1305")!=0)
Definition: unit1305.c:127
UNITTEST_START int rc
Definition: unit1301.c:31

Definition at line 172 of file curl_fuzzer.h.

#define FTRY (   FUNC)
Value:
{ \
int _func_rc = (FUNC); \
if (_func_rc) \
{ \
rc = _func_rc; \
goto EXIT_LABEL; \
} \
}
if(strcmp(arg,"1305")!=0)
Definition: unit1305.c:127
UNITTEST_START int rc
Definition: unit1301.c:31

Definition at line 162 of file curl_fuzzer.h.

#define TEMP_WRITE_ARRAY_SIZE   10

Definition at line 50 of file curl_fuzzer.h.

#define TLV_RC_NO_ERROR   0

TLV function return codes.

Definition at line 45 of file curl_fuzzer.h.

#define TLV_RC_NO_MORE_TLVS   1

Definition at line 46 of file curl_fuzzer.h.

#define TLV_RC_SIZE_ERROR   2

Definition at line 47 of file curl_fuzzer.h.

#define TLV_TYPE_COOKIE   7

Definition at line 35 of file curl_fuzzer.h.

#define TLV_TYPE_CUSTOMREQUEST   10

Definition at line 38 of file curl_fuzzer.h.

#define TLV_TYPE_HEADER   6

Definition at line 34 of file curl_fuzzer.h.

#define TLV_TYPE_MAIL_FROM   12

Definition at line 40 of file curl_fuzzer.h.

#define TLV_TYPE_MAIL_RECIPIENT   11

Definition at line 39 of file curl_fuzzer.h.

#define TLV_TYPE_PASSWORD   4

Definition at line 32 of file curl_fuzzer.h.

#define TLV_TYPE_POSTFIELDS   5

Definition at line 33 of file curl_fuzzer.h.

#define TLV_TYPE_RANGE   9

Definition at line 37 of file curl_fuzzer.h.

#define TLV_TYPE_RESPONSE1   2

Definition at line 30 of file curl_fuzzer.h.

#define TLV_TYPE_UPLOAD1   8

Definition at line 36 of file curl_fuzzer.h.

#define TLV_TYPE_URL   1

TLV types.

Definition at line 29 of file curl_fuzzer.h.

#define TLV_TYPE_USERNAME   3

Definition at line 31 of file curl_fuzzer.h.

Typedef Documentation

typedef struct fuzz_data FUZZ_DATA

Data local to a fuzzing run.

Internal state when parsing a TLV data stream.

typedef struct tlv TLV
typedef struct tlv_raw TLV_RAW

Byte stream representation of the TLV header.

Casting the byte stream to a TLV_RAW allows us to examine the type and length.

Function Documentation

void fuzz_free ( void **  ptr)

If a pointer has been allocated, free that pointer.

Definition at line 196 of file curl_fuzzer.cc.

int fuzz_get_first_tlv ( FUZZ_DATA fuzz,
TLV tlv 
)

TLV access function - gets the first TLV from a data stream.

Definition at line 311 of file curl_fuzzer.cc.

int fuzz_get_next_tlv ( FUZZ_DATA fuzz,
TLV tlv 
)

TLV access function - gets the next TLV from a data stream.

Definition at line 322 of file curl_fuzzer.cc.

int fuzz_get_tlv_comn ( FUZZ_DATA fuzz,
TLV tlv 
)

Common TLV function for accessing TLVs in a data stream.

Definition at line 340 of file curl_fuzzer.cc.

int fuzz_initialize_fuzz_data ( FUZZ_DATA fuzz,
const uint8_t *  data,
size_t  data_len 
)

Initialize the local fuzz data structure.

Definition at line 113 of file curl_fuzzer.cc.

static curl_socket_t fuzz_open_socket ( void *  ptr,
curlsocktype  purpose,
struct curl_sockaddr address 
)
static
int fuzz_parse_tlv ( FUZZ_DATA fuzz,
TLV tlv 
)

Do different actions on the CURL handle for different received TLVs.

Definition at line 367 of file curl_fuzzer.cc.

static size_t fuzz_read_callback ( char *  buffer,
size_t  size,
size_t  nitems,
void *  ptr 
)
static
static int fuzz_sockopt_callback ( void *  ptr,
curl_socket_t  curlfd,
curlsocktype  purpose 
)
static
void fuzz_terminate_fuzz_data ( FUZZ_DATA fuzz)

Terminate the fuzz data structure, including freeing any allocated memory.

Definition at line 166 of file curl_fuzzer.cc.

char* fuzz_tlv_to_string ( TLV tlv)

Converts a TLV data and length into an allocated string.

Definition at line 434 of file curl_fuzzer.cc.

static size_t fuzz_write_callback ( void *  contents,
size_t  size,
size_t  nmemb,
void *  ptr 
)
static
uint16_t to_u16 ( uint8_t  b[2])

Utility function to convert 2 bytes to a u16 predictably.

Definition at line 103 of file curl_fuzzer.cc.

uint32_t to_u32 ( uint8_t  b[4])

Utility function to convert 4 bytes to a u32 predictably.

Definition at line 93 of file curl_fuzzer.cc.



rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:17