test: Add a protocol dump test to generate initial fuzzer input.#2291
Conversation
f5df5f6 to
6d8a3d4
Compare
25d69f7 to
784cc57
Compare
Codecov Report
@@ Coverage Diff @@
## master #2291 +/- ##
==========================================
- Coverage 79.02% 78.92% -0.11%
==========================================
Files 127 127
Lines 24021 24063 +42
==========================================
+ Hits 18983 18992 +9
- Misses 5038 5071 +33
Continue to review full report at Codecov.
|
b95b2ab to
06bf50c
Compare
507ee5d to
9a33057
Compare
2a9e389 to
13cf420
Compare
sudden6
left a comment
There was a problem hiding this comment.
Reviewed 8 of 11 files at r1, 6 of 7 files at r2, all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @iphydf)
testing/fuzzing/bootstrap_harness.cc, line 170 at r1 (raw file):
uint8_t pub_key[TOX_PUBLIC_KEY_SIZE] = {0}; const bool udp_success = tox_bootstrap(tox, "192.168.0.127", 33446, pub_key, nullptr);
Any reason to use IP addresses which might actually be used on the host machine? also how about reading them from fuzzer input? (just a thought and it will invalidate the corpus)
testing/fuzzing/e2e_fuzz_test.cc, line 131 at r1 (raw file):
} static char tox_log_level_name(Tox_Log_Level level)
This function appears multiple times, make it constexpr and put it in a header?
testing/fuzzing/e2e_fuzz_test.cc, line 196 at r2 (raw file):
// Move the clock forward a decent amount so all the time-based checks // trigger more quickly. sys.clock += 200;
I think this needs to be synced between all the fuzzers to be effective, right? This should be documented somewhere, and maybe a named constant. Also I know I was against this earlier, but I think now it really makes sense to read the time step from fuzzer input data so that all the behavior is contained in the corpus files.
testing/fuzzing/protodump.cc, line 188 at r2 (raw file):
{ std::printf("%zu bytes: %s\n", recording.size(), filename); std::ofstream out_init(filename);
Might want to set the binary flag here
iphydf
left a comment
There was a problem hiding this comment.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @sudden6)
testing/fuzzing/bootstrap_harness.cc, line 170 at r1 (raw file):
Previously, sudden6 wrote…
Any reason to use IP addresses which might actually be used on the host machine? also how about reading them from fuzzer input? (just a thought and it will invalidate the corpus)
Reading them from the fuzzer input seems either risky or useless. In case something in toxcore structurally depends on the IP address, the fuzzer will have only a 1 in 4 billion chance of getting the right number. I don't think anything does depend on it, but even if it does, I don't think we'll find anything interesting from twiddling this particular number. If nothing indeed does depend on it, the input here only tests the "IP to string" and then "IP from string" functions, which are better tested outside the bootstrap fuzz test in a more specific test scenario.
Anyway, I've changed them back to (almost) the number you had here.
testing/fuzzing/e2e_fuzz_test.cc, line 131 at r1 (raw file):
Previously, sudden6 wrote…
This function appears multiple times, make it
constexprand put it in a header?
Done.
testing/fuzzing/e2e_fuzz_test.cc, line 196 at r2 (raw file):
Previously, sudden6 wrote…
I think this needs to be synced between all the fuzzers to be effective, right? This should be documented somewhere, and maybe a named constant. Also I know I was against this earlier, but I think now it really makes sense to read the time step from fuzzer input data so that all the behavior is contained in the corpus files.
Done.
testing/fuzzing/protodump.cc, line 188 at r2 (raw file):
Previously, sudden6 wrote…
Might want to set the binary flag here
Done.
sudden6
left a comment
There was a problem hiding this comment.
Reviewed 6 of 6 files at r3, all commit messages.
Reviewable status:complete! 1 of 1 approvals obtained
This change is