Skip to content

Commit 9e922d5

Browse files
Sam Lanciadaenney
Sam Lancia
andcommittedFeb 5, 2023
Add fuzz tests for handshake
This adds a fuzz test to cover the DTLS handshake. Co-Authored-By: Daniele Sluijters <daenney@users.noreply.github.com>
1 parent a50d26c commit 9e922d5

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
 

‎AUTHORS.txt

+2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ Michiel De Backker <mail@backkem.me>
3939
Rachel Chen <rachel@chens.email>
4040
Robert Eperjesi <eperjesi@uber.com>
4141
Ryan Gordon <ryan.gordon@getcruise.com>
42+
Sam Lancia <sam.lancia@motorolasolutions.com>
4243
Sean DuBois <seaduboi@amazon.com>
4344
Sean DuBois <sean@siobud.com>
45+
Shelikhoo <xiaokangwang@outlook.com>
4446
Stefan Tatschner <stefan@rumpelsepp.org>
4547
Steffen Vogel <post@steffenvogel.de>
4648
Vadim <fffilimonov@yandex.ru>

‎pkg/protocol/handshake/fuzz_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package handshake
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func FuzzDtlsHandshake(f *testing.F) {
8+
f.Fuzz(func(t *testing.T, data []byte) {
9+
h := &Handshake{}
10+
if err := h.Unmarshal(data); err != nil {
11+
return
12+
}
13+
buf, err := h.Marshal()
14+
if err != nil {
15+
t.Fatal(err)
16+
}
17+
if len(buf) == 0 {
18+
t.Fatal("Zero buff")
19+
}
20+
})
21+
}

0 commit comments

Comments
 (0)
Please sign in to comment.