Skip to content

Add fuzz test for UnmarshalCandidate - #911

Merged
JoTurk merged 1 commit into
pion:mainfrom
vnykmshr:add-fuzz-unmarshal-candidate
Apr 16, 2026
Merged

Add fuzz test for UnmarshalCandidate#911
JoTurk merged 1 commit into
pion:mainfrom
vnykmshr:add-fuzz-unmarshal-candidate

Conversation

@vnykmshr

Copy link
Copy Markdown
Contributor

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.

@codecov

codecov Bot commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.64%. Comparing base (883b73c) to head (c84deae).
⚠️ Report is 1 commits behind head on main.

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              
Flag Coverage Δ
go 88.64% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JoTurk JoTurk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Can you move this to pre existing file? We try to limit our files count.

@theodorsm

theodorsm commented Apr 16, 2026

Copy link
Copy Markdown
Member

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.

@vnykmshr
vnykmshr force-pushed the add-fuzz-unmarshal-candidate branch from ac15506 to ee18527 Compare April 16, 2026 12:34
@JoTurk

JoTurk commented Apr 16, 2026

Copy link
Copy Markdown
Member

@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.

@vnykmshr
vnykmshr force-pushed the add-fuzz-unmarshal-candidate branch from ee18527 to c84deae Compare April 16, 2026 12:44
@vnykmshr
vnykmshr requested a review from JoTurk April 16, 2026 12:45

@JoTurk JoTurk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :)

@JoTurk
JoTurk merged commit e6483a6 into pion:main Apr 16, 2026
26 of 27 checks passed
@vnykmshr
vnykmshr deleted the add-fuzz-unmarshal-candidate branch April 16, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants