Addresses #28803. This updated harness sets mock time at the beginning of each iteration and deletes the private key file at the end of each iteration. Mock time is used to make the fuzz test more stable, as GetTime
is called at points in i2p
. Deleting the private key file ensures that each iteration is independent from the last. Now, a new key is generated in i2p
every time, so the fuzzer can eventually make progress through the target code.
Re-working this harness also led me and dergoegge to resolve a couple of issues in FuzzedSock
, which allows for full coverage of the i2p
code. Those changes can be seen in #30211.
The SAM protocol for interacting with I2P requires some specifc inputs so it’s best to use a dictionary when running this harness.
0"HELLO VERSION"
1"HELLO REPLY RESULT=OK VERSION="
2"HELLO REPLY RESULT=NOVERSION"
3"HELLO REPLY RESULT=I2P_ERROR"
4"SESSION CREATE"
5"SESSION STATUS RESULT=OK DESTINATION="
6"SESSION STATUS RESULT=DUPLICATED_ID"
7"SESSION STATUS RESULT=DUPLICATED_DEST"
8"SESSION STATUS RESULT=INVALID_ID"
9"SESSION STATUS RESULT=INVALID_KEY"
10"SESSION STATUS RESULT=I2P_ERROR MESSAGE="
11"SESSION ADD"
12"SESSION REMOVE"
13"STREAM CONNECT"
14"STREAM STATUS RESULT=OK"
15"STREAM STATUS RESULT=INVALID_ID"
16"STREAM STATUS RESULT=INVALID_KEY"
17"STREAM STATUS RESULT=CANT_REACH_PEER"
18"STREAM STATUS RESULT=I2P_ERROR MESSAGE="
19"STREAM ACCEPT"
20"STREAM FORWARD"
21"DATAGRAM SEND"
22"RAW SEND"
23"DEST GENERATE"
24"DEST REPLY PUB= PRIV="
25"DEST REPLY RESULT=I2P_ERROR"
26"NAMING LOOKUP"
27"NAMING REPLY RESULT=OK NAME= VALUE="
28"DATAGRAM RECEIVED DESTINATION= SIZE="
29"RAW RECEIVED SIZE="
30"NAMING REPLY RESULT=INVALID_KEY NAME="
31"NAMING REPLY RESULT=KEY_NOT_FOUND NAME="
32"MIN"
33"MAX"
34"STYLE"
35"ID"
36"SILENT"
37"DESTINATION"
38"NAME"
39"SIGNATURE_TYPE"
40"CRYPTO_TYPE"
41"SIZE"
42"HOST"
43"PORT"
44"FROM_PORT"
45"TRANSIENT"
46"STREAM"
47"DATAGRAM"
48"RAW"
49"MASTER"
50"true"
51"false"
I’ll add this dict to qa-assets later on.