(f *testing.F)
| 605 | pp, err := DecodePacket(b) |
| 606 | require.NoError(t, err) |
| 607 | require.Equal(t, followUp, pp) |
| 608 | } |
| 609 | |
| 610 | func FuzzDecodePacket(f *testing.F) { |
| 611 | delayResp := []uint8{ |
| 612 | 0x9, 0x2, 0x0, 0x36, 0x0, 0x0, 0x4, 0x0, 0x0, |
| 613 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, |
| 614 | 0x0, 0x0, 0x0, 0x80, 0x63, 0xff, 0xff, 0x0, |
| 615 | 0x9, 0xba, 0x0, 0x1, 0x0, 0xa, 0x3, 0x7f, |
| 616 | 0x0, 0x0, 0x45, 0xb1, 0x11, 0x5e, 0x4, 0x5d, |
| 617 | 0xd2, 0x6e, 0xb8, 0x59, 0x9f, 0xff, 0xfe, |
| 618 | 0x55, 0xaf, 0x4e, 0x0, 0x1, 0x0, 0x0, |
| 619 | } |
| 620 | managementDefaultDataSet := []uint8{ |
| 621 | 0x0d, 0x12, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 622 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 623 | 0x48, 0x57, 0xdd, 0xff, 0xfe, 0x0e, 0x91, 0xda, 0x00, 0x00, |
| 624 | 0x00, 0x00, 0x04, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 625 | 0x00, 0x00, 0xb7, 0x5f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, |
| 626 | 0x00, 0x16, 0x20, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0xff, |
| 627 | 0xfe, 0xff, 0xff, 0x80, 0x48, 0x57, 0xdd, 0xff, 0xfe, 0x0e, |
| 628 | 0x91, 0xda, 0x00, 0x00, 0x00, 0x00, |
| 629 | } |
| 630 | signalingGrantUnicast := []uint8{0x0c, 0x02, 0x00, 0x38, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, |
| 631 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 632 | 0xe4, 0x1d, 0x2d, 0xff, 0xfe, 0xbb, 0x64, 0x60, 0x00, |
| 633 | 0x01, 0x1d, 0xc4, 0x05, 0x7f, 0x48, 0x57, 0xdd, 0xff, |
| 634 | 0xfe, 0x08, 0x64, 0x88, 0x00, 0x01, 0x00, 0x05, 0x00, |
| 635 | 0x08, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x01, |
| 636 | 0x00, 0x00, |
| 637 | } |
| 638 | managementErrorStatus := []uint8{0x0d, 0x02, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 639 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 640 | 0x48, 0x57, 0xdd, 0xff, 0xfe, 0x08, 0x64, 0x88, 0x00, 0x00, |
| 641 | 0x00, 0x01, 0x04, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 642 | 0x00, 0x00, 0xdc, 0x6c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, |
| 643 | 0x00, 0x08, 0x00, 0x06, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, |
| 644 | 0x00, 0x00, |
| 645 | } |
| 646 | for _, seed := range [][]byte{{}, {0}, {9}, delayResp, managementDefaultDataSet, signalingGrantUnicast, managementErrorStatus} { |
| 647 | f.Add(seed) |
| 648 | } |
| 649 | f.Fuzz(func(t *testing.T, b []byte) { |
| 650 | packet, err := DecodePacket(b) |
| 651 | // check that marshalling works |
| 652 | if err == nil { |
| 653 | // special case for TLVs that have variable length |
| 654 | // which may have padding and thus marshalling produces different results |
| 655 | switch packet.MessageType() { |
| 656 | case MessageManagement: |
| 657 | // ignore ManagementMsgErrorStatus |
| 658 | _, ok := packet.(*ManagementMsgErrorStatus) |
| 659 | if ok { |
| 660 | // skip extra checks |
| 661 | return |
| 662 | } |
| 663 | m := packet.(*Management) |
| 664 | // ignore Management with PortPropertiesNPT TLV |
nothing calls this directly
no test coverage detected
searching dependent graphs…