/src/dovecot/src/lib-http/fuzz-http-response-parser.c
Line | Count | Source |
1 | | /* Copyright (c) Dovecot authors, see top-level COPYING file */ |
2 | | |
3 | | #include "lib.h" |
4 | | #include "istream.h" |
5 | | #include "test-common.h" |
6 | | #include "http-response.h" |
7 | | #include "http-response-parser.h" |
8 | | #include "fuzzer.h" |
9 | | |
10 | 42.2k | FUZZ_BEGIN_DATA(const unsigned char *data, size_t size) |
11 | 42.2k | { |
12 | 42.2k | struct istream *input = test_istream_create_data(data, size); |
13 | 42.2k | struct http_response_parser *parser = |
14 | 42.2k | http_response_parser_init(input, NULL, 0); |
15 | 42.2k | struct http_response response; |
16 | 42.2k | const char *error; |
17 | | |
18 | 706k | while (http_response_parse_next(parser, |
19 | 706k | HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, |
20 | 706k | &response, &error) > 0) ; |
21 | | |
22 | 42.2k | http_response_parser_deinit(&parser); |
23 | 42.2k | i_stream_unref(&input); |
24 | 42.2k | } |
25 | 42.2k | FUZZ_END |