Skip to content

Commit

Permalink
Add fuzz tests for handshake
Browse files Browse the repository at this point in the history
This adds a fuzz test to cover the DTLS handshake.

Co-Authored-By: Daniele Sluijters <[email protected]>
  • Loading branch information
Sam Lancia and daenney committed Feb 5, 2023
1 parent a50d26c commit 9e922d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ Michiel De Backker <[email protected]>
Rachel Chen <[email protected]>
Robert Eperjesi <[email protected]>
Ryan Gordon <[email protected]>
Sam Lancia <[email protected]>
Sean DuBois <[email protected]>
Sean DuBois <[email protected]>
Shelikhoo <[email protected]>
Stefan Tatschner <[email protected]>
Steffen Vogel <[email protected]>
Vadim <[email protected]>
Expand Down
21 changes: 21 additions & 0 deletions pkg/protocol/handshake/fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package handshake

import (
"testing"
)

func FuzzDtlsHandshake(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
h := &Handshake{}
if err := h.Unmarshal(data); err != nil {
return
}
buf, err := h.Marshal()
if err != nil {
t.Fatal(err)
}
if len(buf) == 0 {
t.Fatal("Zero buff")
}
})
}

0 comments on commit 9e922d5

Please sign in to comment.