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 <daenney@users.noreply.github.com>
  • 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 <mail@backkem.me>
Rachel Chen <rachel@chens.email>
Robert Eperjesi <eperjesi@uber.com>
Ryan Gordon <ryan.gordon@getcruise.com>
Sam Lancia <sam.lancia@motorolasolutions.com>
Sean DuBois <seaduboi@amazon.com>
Sean DuBois <sean@siobud.com>
Shelikhoo <xiaokangwang@outlook.com>
Stefan Tatschner <stefan@rumpelsepp.org>
Steffen Vogel <post@steffenvogel.de>
Vadim <fffilimonov@yandex.ru>
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.