Add fuzz test for UnmarshalCandidate - #911
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #911 +/- ##
==========================================
+ Coverage 88.60% 88.64% +0.03%
==========================================
Files 45 45
Lines 5811 5811
==========================================
+ Hits 5149 5151 +2
+ Misses 453 451 -2
Partials 209 209
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
JoTurk
left a comment
There was a problem hiding this comment.
Thank you. Can you move this to pre existing file? We try to limit our files count.
|
This is awesome @vnykmshr, love so see fuzzing being used across our repos! One suggestion is to also search for uses of "MUST NOT" in the RFC to find invalid state for Candiate. You can use it to find assertions that are useful in fuzzing, like we do here in dtls: https://github.com/pion/dtls/blob/fd27a52a64265097a621432090926a651109b4cb/pkg/protocol/extension/certificate_auth_test.go#L137 But don't feel obliged to do more stuff in this PR, this is really useful already. |
ac15506 to
ee18527
Compare
|
@theodorsm unlike dtls ouu ice parsers are a lot forgiving and we don't enforce the rfc in many cases like for example we allow for empty foundation, some invalid characters, bad addresses, and we also explicitly error in some gray areas in the rfc. I don't think we should enforce any parse behavior with fuzzing in ice. |
ee18527 to
c84deae
Compare
The other pion repos (stun, dtls, sdp) have fuzz tests for their parse paths but ice doesn't. UnmarshalCandidate handles remote input so it's a good candidate for coverage.
Adds FuzzUnmarshalCandidate with 14 seed corpus entries covering all candidate types, address families, TCP types, extensions, and edge cases (empty foundation, boundary ports, candidate: prefix). Asserts that successful parses produce candidates that marshal and re-parse without panicking.
1.6M+ executions locally, no crashes found.