forked from skupperproject/skupper-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes skupperproject#1702: add fuzz testing of the http1 decoder
- Loading branch information
Showing
612 changed files
with
93,995 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#include <qpid/dispatch/alloc_pool.h> | ||
|
||
#include "decoders/http1/http1_decoder.h" | ||
#include "qpid/dispatch/ctools.h" | ||
|
||
#include "libFuzzingEngine.h" | ||
|
||
void qd_log_initialize(void); | ||
void qd_error_initialize(void); | ||
void qd_router_id_finalize(void); | ||
void qd_log_finalize(void); | ||
|
||
/** | ||
* This function is processed on exit | ||
*/ | ||
void call_on_exit(void) | ||
{ | ||
qd_log_finalize(); | ||
qd_alloc_finalize(); | ||
qd_router_id_finalize(); | ||
} | ||
|
||
int LLVMFuzzerInitialize(int *argc, char ***argv) | ||
{ | ||
atexit(call_on_exit); | ||
|
||
qd_alloc_initialize(); | ||
qd_log_initialize(); | ||
qd_error_initialize(); | ||
return 0; | ||
} | ||
|
||
// | ||
// Dummy callbacks for the decoder. | ||
// | ||
|
||
static int _rx_request(qd_http1_decoder_connection_t *hconn, | ||
const char *method, | ||
const char *target, | ||
uint32_t version_major, | ||
uint32_t version_minor, | ||
uintptr_t *request_context) | ||
{ | ||
*request_context = 1; | ||
return 0; | ||
} | ||
|
||
static int _rx_response(qd_http1_decoder_connection_t *hconn, uintptr_t request_context, | ||
int status_code, | ||
const char *reason_phrase, | ||
uint32_t version_major, | ||
uint32_t version_minor) | ||
{ return 0; } | ||
|
||
static int _rx_header(qd_http1_decoder_connection_t *hconn, uintptr_t request_context, bool from_client, | ||
const char *key, const char *value) | ||
{ return 0; } | ||
|
||
static int _rx_headers_done(qd_http1_decoder_connection_t *hconn, uintptr_t request_context, bool from_client) | ||
{ return 0; } | ||
|
||
static int _rx_body(qd_http1_decoder_connection_t *hconn, uintptr_t request_context, bool from_client, const unsigned char *body, size_t length) | ||
{ return 0; } | ||
|
||
static int _message_done(qd_http1_decoder_connection_t *hconn, uintptr_t request_context, bool from_client) | ||
{ return 0; } | ||
|
||
static int _transaction_complete(qd_http1_decoder_connection_t *hconn, uintptr_t request_context) | ||
{ return 0; } | ||
|
||
static void _protocol_error(qd_http1_decoder_connection_t *hconn, const char *reason) | ||
{ } | ||
|
||
|
||
const struct qd_http1_decoder_config_t test_config = { | ||
.rx_request = _rx_request, | ||
.rx_response = _rx_response, | ||
.rx_header = _rx_header, | ||
.rx_headers_done = _rx_headers_done, | ||
.rx_body = _rx_body, | ||
.message_done = _message_done, | ||
.transaction_complete = _transaction_complete, | ||
.protocol_error = _protocol_error | ||
}; | ||
|
||
|
||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) | ||
{ | ||
qd_http1_decoder_connection_t *conn_state = qd_http1_decoder_connection(&test_config, 1); | ||
qd_http1_decoder_connection_rx_data(conn_state, true, (const unsigned char *) data, size); | ||
qd_http1_decoder_connection_free(conn_state); | ||
return 0; | ||
} | ||
|
2 changes: 2 additions & 0 deletions
2
tests/fuzz/fuzz_http1_request_decoder/corpus/id:000000,time:0,execs:0,orig:seed1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GET https://host.com/url/path?query HTTP/1.1 | ||
|
5 changes: 5 additions & 0 deletions
5
tests/fuzz/fuzz_http1_request_decoder/corpus/id:000001,time:0,execs:0,orig:seed2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POST /sorl HTTP/1.1 | ||
dumr: hi | ||
content-length: 5 | ||
|
||
12345 |
7 changes: 7 additions & 0 deletions
7
tests/fuzz/fuzz_http1_request_decoder/corpus/id:000002,time:0,execs:0,orig:seed3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
POST /anl HTTP/1.1 | ||
transfer-encoding: a,b,chunked | ||
|
||
03 | ||
ABC | ||
00 | ||
|
7 changes: 7 additions & 0 deletions
7
tests/fuzz/fuzz_http1_request_decoder/corpus/id:000003,time:0,execs:0,orig:seed4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
GET /pipeline/1 HTTP/1.1 | ||
Content-length: 0 | ||
|
||
GET //2 HTTP/1.1 | ||
content-length: 1 | ||
|
||
A |
2 changes: 2 additions & 0 deletions
2
...zz_http1_request_decoder/corpus/id:000004,src:000003,time:8,execs:94,op:havoc,rep:14,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GET e/1 HTP/1.1 | ||
Co |
Binary file added
BIN
+20 Bytes
...z_http1_request_decoder/corpus/id:000005,src:000003,time:9,execs:102,op:havoc,rep:16,+cov
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
...zz/fuzz_http1_request_decoder/corpus/id:000006,src:000003,time:9,execs:110,op:havoc,rep:3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length: 0 | ||
|
||
GET //2 H | ||
A |
1 change: 1 addition & 0 deletions
1
...z_http1_request_decoder/corpus/id:000007,src:000003,time:9,execs:118,op:havoc,rep:10,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
�T |
6 changes: 6 additions & 0 deletions
6
...z_http1_request_decoder/corpus/id:000008,src:000003,time:10,execs:126,op:havoc,rep:2,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
GET /pipeline/1 HTTP/1.1 | ||
TTer: hi | ||
ngth: 1 | ||
c11.ontent-length: 1 | ||
|
||
A | ||
|
Binary file added
BIN
+4 Bytes
...z/fuzz_http1_request_decoder/corpus/id:000009,src:000003,time:10,execs:134,op:havoc,rep:9
Binary file not shown.
Binary file added
BIN
+12 Bytes
...z/fuzz_http1_request_decoder/corpus/id:000010,src:000003,time:10,execs:142,op:havoc,rep:5
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
...z_http1_request_decoder/corpus/id:000011,src:000003,time:10,execs:150,op:havoc,rep:2,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
GET eline/1 HTTP/1.1 | ||
Co1.1 | ||
content-length: 1 | ||
|
||
A |
1 change: 1 addition & 0 deletions
1
.../fuzz_http1_request_decoder/corpus/id:000012,src:000003,time:11,execs:159,op:havoc,rep:15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GET /pi: 1nt-lTP/ | ||
|
1 change: 1 addition & 0 deletions
1
..._http1_request_decoder/corpus/id:000013,src:000003,time:11,execs:168,op:havoc,rep:16,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GET /pi |
17 changes: 17 additions & 0 deletions
17
...z_http1_request_decoder/corpus/id:000014,src:000003,time:11,execs:179,op:havoc,rep:9,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Gne/1 HTTP/1.1 |
2 changes: 2 additions & 0 deletions
2
...z_http1_request_decoder/corpus/id:000015,src:000003,time:12,execs:187,op:havoc,rep:4,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GETTP/1.1 | ||
T |
6 changes: 6 additions & 0 deletions
6
...z_http1_request_decoder/corpus/id:000016,src:000003,time:12,execs:202,op:havoc,rep:1,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length: 0 | ||
|
||
GET //2 HTTP/1.1 | ||
content-length: 1 | ||
A | ||
|
1 change: 1 addition & 0 deletions
1
.../fuzz_http1_request_decoder/corpus/id:000017,src:000003,time:13,execs:216,op:havoc,rep:16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GDT /pi� |
Binary file added
BIN
+8 Bytes
...z/fuzz_http1_request_decoder/corpus/id:000018,src:000003,time:13,execs:229,op:havoc,rep:9
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
...z/fuzz_http1_request_decoder/corpus/id:000019,src:000003,time:13,execs:238,op:havoc,rep:5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length: 0 | ||
|
||
Gt |
7 changes: 7 additions & 0 deletions
7
...z/fuzz_http1_request_decoder/corpus/id:000020,src:000003,time:14,execs:249,op:havoc,rep:2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length: 0 | ||
|
||
GET //2 HTTP/1.1 | ||
coigth: 1 | ||
|
||
A |
1 change: 1 addition & 0 deletions
1
.../fuzz_http1_request_decoder/corpus/id:000021,src:000003,time:14,execs:258,op:havoc,rep:16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GE� |
5 changes: 5 additions & 0 deletions
5
...z/fuzz_http1_request_decoder/corpus/id:000022,src:000003,time:15,execs:275,op:havoc,rep:3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length: 0 | ||
.1 | ||
con | ||
GET /� |
4 changes: 4 additions & 0 deletions
4
...z_http1_request_decoder/corpus/id:000023,src:000003,time:15,execs:286,op:havoc,rep:2,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length:0 | ||
|
||
G |
Binary file added
BIN
+4 Bytes
.../fuzz_http1_request_decoder/corpus/id:000024,src:000003,time:15,execs:305,op:havoc,rep:13
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
...z/fuzz_http1_request_decoder/corpus/id:000025,src:000003,time:16,execs:327,op:havoc,rep:6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
GET e/1 HTTP/1.1 | ||
CotleTP/1.1ngth: 0 | ||
� | ||
G | ||
|
7 changes: 7 additions & 0 deletions
7
...z/fuzz_http1_request_decoder/corpus/id:000026,src:000003,time:18,execs:457,op:havoc,rep:5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
GET line/1 HTTP/1.1 | ||
Congth: 0 | ||
|
||
GET //2 HTTP/1.1 | ||
th:::::::::::::::: 1 | ||
|
||
A |
7 changes: 7 additions & 0 deletions
7
...z_http1_request_decoder/corpus/id:000027,src:000003,time:19,execs:465,op:havoc,rep:2,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
GET eline/1 HTTP/1.1 | ||
Cn: 0 | ||
|
||
GET //2 HTTP/1.1 | ||
content-length: 5 | ||
|
||
A |
7 changes: 7 additions & 0 deletions
7
...z/fuzz_http1_request_decoder/corpus/id:000028,src:000003,time:20,execs:495,op:havoc,rep:5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
GET eline/1 HTTP/1.1 | ||
CT.1 | ||
1 | ||
c1.1 | ||
ct-gth: 1 | ||
|
||
A |
8 changes: 8 additions & 0 deletions
8
...z_http1_request_decoder/corpus/id:000029,src:000003,time:21,execs:563,op:havoc,rep:1,+cov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length:1 | ||
0 | ||
|
||
GET //2 HTTP/1.1 | ||
content-length: 1 | ||
|
||
A |
8 changes: 8 additions & 0 deletions
8
...z/fuzz_http1_request_decoder/corpus/id:000030,src:000003,time:21,execs:575,op:havoc,rep:4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length: 0 | ||
|
||
pET //o HTTP/1.1 | ||
con | ||
.1h: 1 | ||
|
||
A |
6 changes: 6 additions & 0 deletions
6
.../fuzz_http1_request_decoder/corpus/id:000031,src:000003,time:22,execs:598,op:havoc,rep:10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
GE e/1 HTTP/1.1 | ||
eline1.1 | ||
|
||
|
||
GETea | ||
|
||
|
7 changes: 7 additions & 0 deletions
7
.../fuzz_http1_request_decoder/corpus/id:000032,src:000003,time:25,execs:743,op:havoc,rep:12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
T O/e/1 HTTP/1.1 | ||
CongtttttttHTTP/1.1 | ||
Ce | ||
0' | ||
// | ||
|
||
A | ||
|
8 changes: 8 additions & 0 deletions
8
...z/fuzz_http1_request_decoder/corpus/id:000033,src:000003,time:26,execs:801,op:havoc,rep:3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
GET eline/1 HTTP/1.1 | ||
Content-length: 0 | ||
|
||
GET //2 HTTP/1.1 | ||
congt1:.1 | ||
th: 0 | ||
|
||
GET 1 |
Oops, something went wrong.