Skip to content

Commit

Permalink
Fuzzing add seed into files
Browse files Browse the repository at this point in the history
Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
  • Loading branch information
0x34d committed Nov 11, 2023
1 parent ba4fb56 commit 306177c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 77 deletions.
90 changes: 13 additions & 77 deletions fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,87 +2,23 @@
// SPDX-License-Identifier: MIT
package dtls

import "testing"
import (
"os"
"testing"
)

func FuzzUnmarshalBinary(f *testing.F) {

Check failure on line 10 in fuzz_test.go

View workflow job for this annotation

GitHub Actions / lint / Go

unnecessary leading newline (whitespace)
TestResumeClient := []byte{
0xfe, 0x01, 0x1e, 0xff, 0x81, 0x03, 0x01, 0x01, 0x01, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x53,
0x74, 0x61, 0x74, 0x65, 0x01, 0xff, 0x82, 0x01, 0x01, 0x01, 0x01, 0x01, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x45, 0x70, 0x6f,
0x63, 0x68, 0x01, 0x01, 0x01, 0x01, 0x01, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x01, 0x01,
0x00, 0x01, 0x01, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x01, 0xff, 0x84, 0x01, 0x01, 0x01,
0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x01, 0xff, 0x84, 0x01, 0x01, 0x01, 0x43, 0x69,
0x70, 0x68, 0x65, 0x72, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x44, 0x01, 0x01, 0x01, 0x01, 0x01, 0x4d, 0x61, 0x73, 0x74,
0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x01, 0x01, 0x01, 0x01, 0x01, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63,
0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x01, 0x01, 0x01, 0x01, 0x15, 0x53, 0x52, 0x54, 0x50, 0x50, 0x72, 0x6f, 0x74,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x01, 0x01, 0x01, 0x01, 0x10, 0x50, 0x65,
0x65, 0x72, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x01, 0xff, 0x86, 0x01, 0x01, 0x01,
0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x48, 0x69, 0x6e, 0x74, 0x01, 0x01, 0x01, 0x01, 0x01, 0x53, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x01, 0x01, 0x01, 0x01, 0x11, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x6e,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x01, 0x01, 0x01, 0x01, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43,
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x01, 0x01, 0x01, 0x01, 0x01, 0x49, 0x73, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19, 0xff, 0x83, 0x01, 0x01, 0x01, 0x01, 0x5b, 0x33, 0x32, 0x5d,
0x75, 0x69, 0x6e, 0x74, 0x38, 0x01, 0xff, 0x84, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x17, 0xff, 0x85, 0x01, 0x01,
0x01, 0x01, 0x5b, 0x5d, 0x5b, 0x5d, 0x75, 0x69, 0x6e, 0x74, 0x38, 0x01, 0xff, 0x86, 0x01, 0x01, 0x01, 0x01, 0x01, 0xfe,
0x01, 0x5e, 0xff, 0x82, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x65, 0x26, 0x4d, 0xff, 0xd0, 0x6c, 0x64, 0xff, 0xd4, 0x3f,
0x4c, 0x3d, 0xff, 0xcb, 0xff, 0xc9, 0x30, 0x64, 0xff, 0xaa, 0x3a, 0x1a, 0x77, 0xff, 0x92, 0xff, 0xa0, 0x4e, 0x6d, 0xff,
0xfd, 0xff, 0x97, 0xff, 0x9a, 0x23, 0xff, 0xfc, 0x15, 0xff, 0xa9, 0x65, 0xff, 0xf9, 0xff, 0xa3, 0x01, 0x20, 0x65, 0x26,
0x4d, 0xff, 0xd0, 0xff, 0xf7, 0x77, 0x46, 0x75, 0xff, 0xd0, 0x59, 0x4c, 0x50, 0xff, 0xf2, 0xff, 0xd7, 0x16, 0x41, 0x45,
0x5e, 0xff, 0xff, 0xff, 0xd1, 0x5e, 0x13, 0x34, 0xff, 0xdf, 0xff, 0xb8, 0xff, 0x92, 0xff, 0xe8, 0xff, 0x9e, 0xff, 0x80,
0x2c, 0xff, 0x80, 0xff, 0xf8, 0x01, 0xfe, 0xc0, 0x2b, 0x01, 0x30, 0xc3, 0xd2, 0x7a, 0xec, 0x1a, 0xc0, 0xae, 0xf6, 0x6f,
0xde, 0x7c, 0x69, 0x45, 0x53, 0x9c, 0xd0, 0xe9, 0x3c, 0x31, 0x95, 0x53, 0x48, 0x68, 0xc7, 0xf0, 0x4d, 0x01, 0x46, 0xf6,
0x36, 0x44, 0x1d, 0x6a, 0x8c, 0x17, 0x2d, 0x8e, 0x64, 0x98, 0x8b, 0x62, 0xdd, 0xf6, 0xf8, 0x01, 0x97, 0x55, 0x29, 0x01,
0x01, 0x01, 0x01, 0xfe, 0x01, 0xb7, 0x30, 0x82, 0x01, 0xb3, 0x30, 0x82, 0x01, 0x59, 0xa0, 0x01, 0x01, 0x01, 0x01, 0x01,
0x11, 0x01, 0x25, 0x79, 0xf8, 0xd3, 0x4b, 0x01, 0x01, 0xbb, 0x75, 0x95, 0x01, 0xcc, 0x78, 0xae, 0x87, 0xeb, 0x30, 0x01,
0x01, 0x01, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x01, 0x30, 0x1b, 0x31, 0x19, 0x30, 0x17, 0x01, 0x01, 0x55, 0x01,
0x01, 0x13, 0x10, 0x73, 0x65, 0x6c, 0x66, 0x2d, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x63, 0x65, 0x72, 0x74, 0x30,
0x1e, 0x17, 0x01, 0x32, 0x33, 0x31, 0x30, 0x31, 0x31, 0x30, 0x37, 0x32, 0x35, 0x30, 0x34, 0x5a, 0x17, 0x01, 0x32, 0x33,
0x31, 0x31, 0x31, 0x31, 0x30, 0x37, 0x32, 0x35, 0x30, 0x34, 0x5a, 0x30, 0x1b, 0x31, 0x19, 0x30, 0x17, 0x01, 0x01, 0x55,
0x01, 0x01, 0x13, 0x10, 0x73, 0x65, 0x6c, 0x66, 0x2d, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x63, 0x65, 0x72, 0x74,
0x30, 0x59, 0x30, 0x13, 0x01, 0x01, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x01, 0x01, 0x2a, 0x86, 0x48, 0xce, 0x3d,
0x01, 0x01, 0x01, 0x01, 0x42, 0x01, 0x01, 0xe1, 0xc7, 0x5a, 0x7f, 0xe6, 0x2f, 0xc1, 0xbb, 0x2d, 0x5a, 0xf8, 0x23, 0x59,
0x17, 0x12, 0x22, 0x9d, 0x91, 0xe1, 0x19, 0x6f, 0xa4, 0x89, 0x23, 0x01, 0x83, 0x80, 0x31, 0x41, 0x4d, 0xda, 0xf8, 0xc8,
0xf2, 0xf4, 0x40, 0x52, 0xee, 0x74, 0x12, 0x1b, 0xdf, 0x4f, 0xd8, 0x14, 0x49, 0xf6, 0x81, 0x52, 0xce, 0xed, 0x23, 0xe7,
0x49, 0x51, 0xed, 0x9b, 0xca, 0x4b, 0xd8, 0x65, 0xa5, 0x7f, 0x82, 0xa3, 0x7e, 0x30, 0x7c, 0x30, 0x01, 0x01, 0x01, 0x55,
0x1d, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x84, 0x30, 0x1d, 0x01, 0x01, 0x55, 0x1d, 0x25, 0x01, 0x16,
0x30, 0x14, 0x01, 0x01, 0x2b, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x2b, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x30, 0x01, 0x01, 0x01, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x01, 0x01, 0x30, 0x01, 0x01, 0x01, 0xff, 0x30,
0x1d, 0x01, 0x01, 0x55, 0x1d, 0x01, 0x01, 0x16, 0x01, 0x14, 0x6e, 0x65, 0xf7, 0xe1, 0x38, 0x2b, 0x01, 0xb8, 0x3e, 0xc4,
0xf9, 0xe3, 0x72, 0xab, 0x5f, 0xd9, 0x8c, 0x01, 0xb6, 0x23, 0x30, 0x1b, 0x01, 0x01, 0x55, 0x1d, 0x11, 0x01, 0x14, 0x30,
0x12, 0x82, 0x10, 0x73, 0x65, 0x6c, 0x66, 0x2d, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x63, 0x65, 0x72, 0x74, 0x30,
0x01, 0x01, 0x01, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x01, 0x01, 0x48, 0x01, 0x30, 0x45, 0x01, 0x21, 0x01, 0xd0,
0xca, 0x12, 0x9c, 0x25, 0x7f, 0x3f, 0x11, 0x77, 0xdc, 0x26, 0x69, 0x9f, 0xe0, 0xb2, 0xb8, 0x35, 0x78, 0xf5, 0x88, 0x64,
0x8e, 0xc5, 0xc5, 0xdb, 0xf1, 0xb8, 0x49, 0x15, 0xea, 0x67, 0xe6, 0x01, 0x20, 0x41, 0x40, 0xc3, 0xde, 0xca, 0x13, 0x9b,
0xe8, 0x10, 0x3c, 0xb6, 0xba, 0xf6, 0x01, 0xee, 0x8c, 0xa6, 0xf1, 0xda, 0x01, 0xab, 0x01, 0xe8, 0x12, 0x92, 0x35, 0x43,
0xca, 0xf8, 0xec, 0xde, 0x01, 0x01, 0x01, 0x01,
}
TestResumeServer := []byte{
0xfe, 0x01, 0x1e, 0xff, 0x81, 0x01, 0x01, 0x01, 0x01, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x53,
0x74, 0x61, 0x74, 0x65, 0x01, 0xff, 0x82, 0x01, 0x01, 0x01, 0x01, 0x01, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x45, 0x70, 0x6f,
0x63, 0x68, 0x01, 0x01, 0x01, 0x01, 0x01, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x01, 0x01,
0x01, 0x01, 0x01, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x01, 0xff, 0x84, 0x01, 0x01, 0x01,
0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x01, 0xff, 0x84, 0x01, 0x01, 0x01, 0x43, 0x69,
0x70, 0x68, 0x65, 0x72, 0x53, 0x75, 0x69, 0x74, 0x65, 0x49, 0x44, 0x01, 0x01, 0x01, 0x01, 0x01, 0x4d, 0x61, 0x73, 0x74,
0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x01, 0x01, 0x01, 0x01, 0x01, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63,
0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x01, 0x01, 0x01, 0x01, 0x15, 0x53, 0x52, 0x54, 0x50, 0x50, 0x72, 0x6f, 0x74,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x01, 0x01, 0x01, 0x01, 0x10, 0x50, 0x65,
0x65, 0x72, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x01, 0xff, 0x86, 0x01, 0x01, 0x01,
0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x48, 0x69, 0x6e, 0x74, 0x01, 0x01, 0x01, 0x01, 0x01, 0x53, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x01, 0x01, 0x01, 0x01, 0x11, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x6e,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x01, 0x01, 0x01, 0x01, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43,
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x01, 0x01, 0x01, 0x01, 0x01, 0x49, 0x73, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19, 0xff, 0x83, 0x01, 0x01, 0x01, 0x01, 0x5b, 0x33, 0x32, 0x5d,
0x75, 0x69, 0x6e, 0x74, 0x38, 0x01, 0xff, 0x84, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x17, 0xff, 0x85, 0x01, 0x01,
0x01, 0x01, 0x5b, 0x5d, 0x5b, 0x5d, 0x75, 0x69, 0x6e, 0x74, 0x38, 0x01, 0xff, 0x86, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff,
0x9d, 0xff, 0x82, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x65, 0x26, 0x4d, 0xff, 0xe1, 0xff, 0xc4, 0x4b, 0xff, 0xc7, 0x1a,
0x27, 0xff, 0xae, 0x11, 0xff, 0xeb, 0x2f, 0xff, 0x91, 0x6b, 0x5a, 0x1a, 0x4f, 0x36, 0x67, 0xff, 0xf2, 0x4d, 0x50, 0xff,
0xfa, 0x49, 0xff, 0xbe, 0xff, 0xe1, 0x19, 0xff, 0xa1, 0xff, 0xfe, 0xff, 0xf5, 0x7d, 0x01, 0x20, 0x65, 0x26, 0x4d, 0xff,
0xe1, 0xff, 0xd0, 0xff, 0xe8, 0xff, 0xda, 0xff, 0x85, 0x40, 0xff, 0xbc, 0x43, 0x73, 0x2e, 0x3d, 0xff, 0xad, 0x1b, 0x35,
0x5a, 0xff, 0xa3, 0x7b, 0x7f, 0xff, 0xba, 0xff, 0xdb, 0x72, 0x67, 0x3a, 0x5b, 0xff, 0xa1, 0xff, 0x98, 0x4c, 0x65, 0xff,
0xda, 0x01, 0xfe, 0xc0, 0x2b, 0x01, 0x30, 0x79, 0x8d, 0xe7, 0xfc, 0x2a, 0x8f, 0x92, 0x7f, 0x5b, 0x8a, 0x5c, 0x42, 0xa0,
0x47, 0x45, 0x76, 0xea, 0x35, 0xec, 0xd9, 0x95, 0x3d, 0x92, 0x75, 0x01, 0xf5, 0x43, 0x77, 0x50, 0x39, 0xeb, 0xa0, 0x72,
0xef, 0x34, 0x38, 0x72, 0xcb, 0x79, 0xe2, 0xe3, 0x19, 0x3b, 0x6b, 0x2e, 0x45, 0x13, 0x11, 0x01, 0x01, 0x01,

Check failure on line 11 in fuzz_test.go

View workflow job for this annotation

GitHub Actions / lint / Go

File is not `gofumpt`-ed (gofumpt)
TestResumeClient, err := os.ReadFile("testdata/TestResumeClient.raw")
if err != nil {
return
}
f.Add(TestResumeClient)

TestResumeServer, err := os.ReadFile("testdata/TestResumeServer.raw")
if err != nil {
return
}
f.Add(TestResumeServer)

f.Fuzz(func(t *testing.T, data []byte) {
Expand Down
Binary file added testdata/TestResumeClient.raw
Binary file not shown.
1 change: 1 addition & 0 deletions testdata/TestResumeServer.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
���serializedState��LocalEpochRemoteEpochLocalRandom��RemoteRandom��CipherSuiteIDMasterSecretSequenceNumberSRTPProtectionProfilePeerCertificates��IdentityHintSessionIDLocalConnectionIDRemoteConnectionIDIsClient��[32]uint8��@��[][]uint8������ e&M����K��'����/��kZO6g��MP��I����������} e&M����������@��Cs.=��5Z��{����rg:[����Le����+0y���*��[�\B�GEv�5�ٕ=�u�CwP9�r�48r�y��;k.E

0 comments on commit 306177c

Please sign in to comment.