|
GNU libmicrohttpd 1.0.9
|
Fuzzer for MHD_post_process() More...

Go to the source code of this file.
Macros | |
| #define | FUZZ_HARNESS_NAME "fuzz_postprocessor" |
| #define | ADD(s) |
| #define | PSEED(t) |
Functions | |
| static enum MHD_Result | dummy_ahc (void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **req_cls) |
| static void | stop_shared_daemon (void) |
| static void | print_stats (void) |
| static struct MHD_Daemon * | get_shared_daemon (void) |
| static enum MHD_Result | post_iter (void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size) |
| int | LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) |
| static size_t | fuzz_generate (struct fuzz_rng *rng, uint8_t *buf, size_t cap) |
| static size_t | fuzz_seed_count (void) |
| static const uint8_t * | fuzz_seed_get (size_t idx, size_t *len) |
Variables | |
| static const size_t | pp_buf_sizes [] |
| static const size_t | chunk_patterns [] |
| static struct MHD_Daemon * | shared_daemon |
| static unsigned long | stat_pp_created |
| static unsigned long | stat_pp_failed |
| static unsigned long | stat_values |
| static const char *const | gen_disp [] |
| static const char *const | gen_kv [] |
| static const struct pp_seed | pp_seeds [] |
Fuzzer for MHD_post_process()
MHD_create_post_processor() only ever looks at the "Content-Type" header of the connection it is given, so this harness fabricates the minimal connection object instead of pushing a whole request through a socket. That keeps the harness fast and lets the fuzzer control three dimensions that matter for the post processor and that a real request would not expose directly:
Input format: byte 0 content type selector byte 1 post processor buffer size selector byte 2 chunking pattern selector byte 3 length of the boundary taken from the payload byte 4.. the POST data
Definition in file fuzz_postprocessor.c.
| #define ADD | ( | s | ) |
Referenced by fuzz_generate().
| #define FUZZ_HARNESS_NAME "fuzz_postprocessor" |
Definition at line 44 of file fuzz_postprocessor.c.
Referenced by print_stats().
| #define PSEED | ( | t | ) |
Definition at line 443 of file fuzz_postprocessor.c.
|
static |
Definition at line 68 of file fuzz_postprocessor.c.
References MHD_NO.
Referenced by get_shared_daemon().

|
static |
Definition at line 349 of file fuzz_postprocessor.c.
References ADD, fuzz_below(), fuzz_byte(), fuzz_chance(), gen_disp, and gen_kv.

|
static |
Definition at line 465 of file fuzz_postprocessor.c.
References pp_seeds.
|
static |
Definition at line 472 of file fuzz_postprocessor.c.
References pp_seeds.
|
static |
Definition at line 108 of file fuzz_postprocessor.c.
References dummy_ahc(), fuzz_verbose, MHD_OPTION_END, MHD_start_daemon(), MHD_USE_ERROR_LOG, MHD_USE_NO_LISTEN_SOCKET, NULL, print_stats(), shared_daemon, and stop_shared_daemon().
Referenced by LLVMFuzzerTestOneInput().


| int LLVMFuzzerTestOneInput | ( | const uint8_t * | data, |
| size_t | size ) |
The fuzz target. Signature is the libFuzzer one on purpose, so that the very same harness can be linked with libFuzzer or AFL++ later.
< see queue_unprocessed_conn()
Definition at line 188 of file fuzz_postprocessor.c.
References chunk_patterns, MHD_Connection::daemon, data, get_shared_daemon(), MHD_HTTP_Req_Header::header, MHD_HTTP_Req_Header::header_size, MHD_Request::headers_received, MHD_Request::headers_received_tail, MHD_HTTP_Req_Header::kind, MHD_CONNECTION_HEADERS_PROCESSED, MHD_create_post_processor(), MHD_destroy_post_processor(), MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_TYPE, MHD_HTTP_POST_ENCODING_FORM_URLENCODED, MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, MHD_post_process(), MHD_STATICSTR_LEN_, NULL, post_iter(), pp_buf_sizes, MHD_Connection::rq, shared_daemon, stat_pp_created, stat_pp_failed, MHD_Connection::state, MHD_HTTP_Req_Header::value, and MHD_HTTP_Req_Header::value_size.

|
static |
Definition at line 136 of file fuzz_postprocessor.c.
References data, fuzz_report_finding(), MHD_YES, NULL, and stat_values.
Referenced by LLVMFuzzerTestOneInput().


|
static |
Definition at line 95 of file fuzz_postprocessor.c.
References FUZZ_HARNESS_NAME, fuzz_verbose, stat_pp_created, stat_pp_failed, and stat_values.
Referenced by get_shared_daemon().

|
static |
Definition at line 84 of file fuzz_postprocessor.c.
References MHD_stop_daemon(), NULL, and shared_daemon.
Referenced by get_shared_daemon().


|
static |
Definition at line 55 of file fuzz_postprocessor.c.
Referenced by LLVMFuzzerTestOneInput().
|
static |
Definition at line 328 of file fuzz_postprocessor.c.
Referenced by fuzz_generate().
|
static |
Definition at line 341 of file fuzz_postprocessor.c.
Referenced by fuzz_generate().
|
static |
Definition at line 51 of file fuzz_postprocessor.c.
Referenced by LLVMFuzzerTestOneInput().
|
static |
Definition at line 445 of file fuzz_postprocessor.c.
Referenced by fuzz_seed_count(), and fuzz_seed_get().
|
static |
Definition at line 59 of file fuzz_postprocessor.c.
Referenced by get_shared_daemon(), LLVMFuzzerTestOneInput(), and stop_shared_daemon().
|
static |
Statistics, printed at exit with –verbose.
Definition at line 62 of file fuzz_postprocessor.c.
Referenced by LLVMFuzzerTestOneInput(), and print_stats().
|
static |
Definition at line 63 of file fuzz_postprocessor.c.
Referenced by LLVMFuzzerTestOneInput(), and print_stats().
|
static |
Definition at line 64 of file fuzz_postprocessor.c.
Referenced by post_iter(), and print_stats().