Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added TryMarshalUnmarshal for fuzzers #340

Merged
merged 1 commit into from
Jul 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,19 @@
}
return res
}

// TryMarshalUnmarshal attempts to marshal and unmarshal a message. Added for fuzzing.
func TryMarshalUnmarshal(msg []byte) int {
p := &packet{}
err := p.unmarshal(false, msg)
if err != nil {
return 0

Check warning on line 218 in packet.go

View check run for this annotation

Codecov / codecov/patch

packet.go#L214-L218

Added lines #L214 - L218 were not covered by tests
}

_, err = p.marshal(false)
if err != nil {
return 0

Check warning on line 223 in packet.go

View check run for this annotation

Codecov / codecov/patch

packet.go#L221-L223

Added lines #L221 - L223 were not covered by tests
}

return 1

Check warning on line 226 in packet.go

View check run for this annotation

Codecov / codecov/patch

packet.go#L226

Added line #L226 was not covered by tests
}
Loading