diff --git a/pkg/formatdecenc/rtph264/decoder_test.go b/pkg/formatdecenc/rtph264/decoder_test.go index 6486d3f0..cbedc820 100644 --- a/pkg/formatdecenc/rtph264/decoder_test.go +++ b/pkg/formatdecenc/rtph264/decoder_test.go @@ -452,188 +452,21 @@ func TestDecodeUntilMarker(t *testing.T) { require.Equal(t, [][]byte{{0x01, 0x02}, {0x01, 0x02}}, nalus) } -func TestDecodeErrors(t *testing.T) { - for _, ca := range []struct { - name string - pkts []*rtp.Packet - err string - }{ - { - "missing payload", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - }, - }, - "payload is too short", - }, - { - "STAP-A without NALUs", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x18}, - }, - }, - "STAP-A packet doesn't contain any NALU", - }, - { - "STAP-A without size", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x18, 0x01}, - }, - }, - "invalid STAP-A packet (invalid size)", - }, - { - "STAP-A with invalid size", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x18, 0x00, 0x15}, - }, - }, - "invalid STAP-A packet (invalid size)", - }, - { - "FU-A without payload", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x1c}, - }, - }, - "invalid FU-A packet (invalid size)", - }, - { - "FU-A with start and end bit", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x1c, 0b11000000}, - }, - }, - "invalid FU-A packet (can't contain both a start and end bit)", - }, - { - "FU-A non-starting 1", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x1c, 0b01000000}, - }, - }, - "received a non-starting fragment without any previous starting fragment", - }, - { - "FU-A non-starting 2", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x05}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 8), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17646, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x1c, 0b01000000}, - }, - }, - "invalid FU-A packet (non-starting)", - }, - { - "MTAP", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x1a}, - }, - }, - "packet type not supported (MTAP-16)", - }, - } { - t.Run(ca.name, func(t *testing.T) { - d := &Decoder{} - d.Init() +func FuzzDecoderUnmarshal(f *testing.F) { + d := &Decoder{} + d.Init() - var lastErr error - for _, pkt := range ca.pkts { - _, _, lastErr = d.Decode(pkt) - } - require.EqualError(t, lastErr, ca.err) + f.Fuzz(func(t *testing.T, b []byte) { + d.Decode(&rtp.Packet{ + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: b, }) - } + }) } diff --git a/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/048b606517c23baffac96520675af386f92f471f22f098caec184d581dd6292e b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/048b606517c23baffac96520675af386f92f471f22f098caec184d581dd6292e new file mode 100644 index 00000000..d4bdeb53 --- /dev/null +++ b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/048b606517c23baffac96520675af386f92f471f22f098caec184d581dd6292e @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("800") diff --git a/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/17ec193e17dd91d1b2a621884383564489d9f873db1b015a693c79fb7c1c1a46 b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/17ec193e17dd91d1b2a621884383564489d9f873db1b015a693c79fb7c1c1a46 new file mode 100644 index 00000000..527d8eac --- /dev/null +++ b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/17ec193e17dd91d1b2a621884383564489d9f873db1b015a693c79fb7c1c1a46 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("\x1c\xd4") diff --git a/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/55cc57e8de6f7821309a6444040480f3aa0128b6b6cd96325b7997ff47d5d29d b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/55cc57e8de6f7821309a6444040480f3aa0128b6b6cd96325b7997ff47d5d29d new file mode 100644 index 00000000..45be281e --- /dev/null +++ b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/55cc57e8de6f7821309a6444040480f3aa0128b6b6cd96325b7997ff47d5d29d @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("8") diff --git a/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/c30437d5edf1393c2957896ca6c4e4d0467a50451fd1feb1cae249fdcbf25a5a b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/c30437d5edf1393c2957896ca6c4e4d0467a50451fd1feb1cae249fdcbf25a5a new file mode 100644 index 00000000..3152792e --- /dev/null +++ b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/c30437d5edf1393c2957896ca6c4e4d0467a50451fd1feb1cae249fdcbf25a5a @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("\x1c") diff --git a/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/c89423ac94e1743f63fb142431eed08c3b74e51a4e7b8ed44a1ba826ca6129d9 b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/c89423ac94e1743f63fb142431eed08c3b74e51a4e7b8ed44a1ba826ca6129d9 new file mode 100644 index 00000000..d8912895 --- /dev/null +++ b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/c89423ac94e1743f63fb142431eed08c3b74e51a4e7b8ed44a1ba826ca6129d9 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("9") diff --git a/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 new file mode 100644 index 00000000..67322c70 --- /dev/null +++ b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("") diff --git a/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/f428976a5b2917c009d1f28d7a96e81095be8631f062798130aa7e6835b67b01 b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/f428976a5b2917c009d1f28d7a96e81095be8631f062798130aa7e6835b67b01 new file mode 100644 index 00000000..9756ef63 --- /dev/null +++ b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/f428976a5b2917c009d1f28d7a96e81095be8631f062798130aa7e6835b67b01 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("80") diff --git a/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/fe107a097efccd5098d6b0147ef4b39f0e467f0257dbf8f8b2f256c235640a6e b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/fe107a097efccd5098d6b0147ef4b39f0e467f0257dbf8f8b2f256c235640a6e new file mode 100644 index 00000000..66d6d123 --- /dev/null +++ b/pkg/formatdecenc/rtph264/testdata/fuzz/FuzzDecoderUnmarshal/fe107a097efccd5098d6b0147ef4b39f0e467f0257dbf8f8b2f256c235640a6e @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("\x1c0") diff --git a/pkg/formatdecenc/rtph265/decoder_test.go b/pkg/formatdecenc/rtph265/decoder_test.go index 62dda5b5..497e7f81 100644 --- a/pkg/formatdecenc/rtph265/decoder_test.go +++ b/pkg/formatdecenc/rtph265/decoder_test.go @@ -174,185 +174,21 @@ func TestDecode(t *testing.T) { } } -func TestDecodeErrors(t *testing.T) { - for _, ca := range []struct { - name string - pkts []*rtp.Packet - err string - }{ - { - "missing payload", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - }, - }, - "payload is too short", - }, - { - "aggregation unit no size", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{48 << 1, 0x00, 0x01}, - }, - }, - "invalid aggregation unit (invalid size)", - }, - { - "aggregation unit invalid size", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{48 << 1, 0x00, 0x00, 0x05, 0x00}, - }, - }, - "invalid aggregation unit (invalid size)", - }, - { - "aggregation unit no NALUs", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{48 << 1, 0x00, 0x00, 0x00}, - }, - }, - "aggregation unit doesn't contain any NALU", - }, - { - "fragmentation unit invalid", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{49 << 1, 0x00}, - }, - }, - "payload is too short", - }, - { - "fragmentation unit start and end bit", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{49 << 1, 0x00, 0b11000000}, - }, - }, - "invalid fragmentation unit (can't contain both a start and end bit)", - }, - { - "fragmentation unit non-starting 1", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{49 << 1, 0x00, 0b01000000}, - }, - }, - "received a non-starting fragment without any previous starting fragment", - }, - { - "fragmentation unit non-starting 2", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x01, 0x00}, - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{49 << 1, 0x00, 0b00000000}, - }, - }, - "invalid fragmentation unit (non-starting)", - }, - { - "paci", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 96, - SequenceNumber: 17645, - Timestamp: 2289527317, - SSRC: 0x9dbb7812, - }, - Payload: []byte{50 << 1, 0x00}, - }, - }, - "PACI packets are not supported (yet)", - }, - } { - t.Run(ca.name, func(t *testing.T) { - d := &Decoder{} - d.Init() +func FuzzDecoderUnmarshal(f *testing.F) { + d := &Decoder{} + d.Init() - var lastErr error - for _, pkt := range ca.pkts { - _, _, lastErr = d.Decode(pkt) - } - require.EqualError(t, lastErr, ca.err) + f.Fuzz(func(t *testing.T, b []byte) { + d.Decode(&rtp.Packet{ + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: b, }) - } + }) } diff --git a/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/353ba911ad2dc1916f0bb9eb5e553575e27c9a6662e86d265f55bd57d1746962 b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/353ba911ad2dc1916f0bb9eb5e553575e27c9a6662e86d265f55bd57d1746962 new file mode 100644 index 00000000..955f0420 --- /dev/null +++ b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/353ba911ad2dc1916f0bb9eb5e553575e27c9a6662e86d265f55bd57d1746962 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("a00") diff --git a/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/6e0463cbdc2d559f2823538d2efee4a8b811c3ea02d2bd8e0f306d81382d5698 b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/6e0463cbdc2d559f2823538d2efee4a8b811c3ea02d2bd8e0f306d81382d5698 new file mode 100644 index 00000000..640bbd63 --- /dev/null +++ b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/6e0463cbdc2d559f2823538d2efee4a8b811c3ea02d2bd8e0f306d81382d5698 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("a0") diff --git a/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/95aa14d7ab02ec8b5c470dcc780587540caba1589c6a7ce702ff84edca9b3133 b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/95aa14d7ab02ec8b5c470dcc780587540caba1589c6a7ce702ff84edca9b3133 new file mode 100644 index 00000000..6da6ac77 --- /dev/null +++ b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/95aa14d7ab02ec8b5c470dcc780587540caba1589c6a7ce702ff84edca9b3133 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("d0") diff --git a/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/c4389a565e8280502fc611cde347896b5d167806b2e49e22db23bed73deef75b b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/c4389a565e8280502fc611cde347896b5d167806b2e49e22db23bed73deef75b new file mode 100644 index 00000000..81d331a2 --- /dev/null +++ b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/c4389a565e8280502fc611cde347896b5d167806b2e49e22db23bed73deef75b @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("a000") diff --git a/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 new file mode 100644 index 00000000..67322c70 --- /dev/null +++ b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/caf81e9797b19c76c1fc4dbf537d4d81f389524539f402d13aa01f93a65ac7e9 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("") diff --git a/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/cb84a08ac93f5772ee3ba0f0bcfde81c9cd71a403c69f893cebc8378c60af625 b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/cb84a08ac93f5772ee3ba0f0bcfde81c9cd71a403c69f893cebc8378c60af625 new file mode 100644 index 00000000..21e5bfa4 --- /dev/null +++ b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/cb84a08ac93f5772ee3ba0f0bcfde81c9cd71a403c69f893cebc8378c60af625 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("bbbbbbbbbbbbb0") diff --git a/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/e45ead12fae619dd0807aaf83341d58eca4d50fab6eefbe78953581a1a4df198 b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/e45ead12fae619dd0807aaf83341d58eca4d50fab6eefbe78953581a1a4df198 new file mode 100644 index 00000000..51709cd9 --- /dev/null +++ b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/e45ead12fae619dd0807aaf83341d58eca4d50fab6eefbe78953581a1a4df198 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("b0\xcd") diff --git a/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/eb4593a9592045ab0cf0b17a3f9f2754d6898ee465ec32d9e08392bcbab0a81a b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/eb4593a9592045ab0cf0b17a3f9f2754d6898ee465ec32d9e08392bcbab0a81a new file mode 100644 index 00000000..75378806 --- /dev/null +++ b/pkg/formatdecenc/rtph265/testdata/fuzz/FuzzDecoderUnmarshal/eb4593a9592045ab0cf0b17a3f9f2754d6898ee465ec32d9e08392bcbab0a81a @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("b0") diff --git a/pkg/formatdecenc/rtplpcm/decoder_test.go b/pkg/formatdecenc/rtplpcm/decoder_test.go index e6a4e84f..7be66e91 100644 --- a/pkg/formatdecenc/rtplpcm/decoder_test.go +++ b/pkg/formatdecenc/rtplpcm/decoder_test.go @@ -106,3 +106,26 @@ func TestDecode(t *testing.T) { }) } } + +func FuzzDecoderUnmarshal(f *testing.F) { + d := &Decoder{ + BitDepth: 24, + SampleRate: 48000, + ChannelCount: 2, + } + d.Init() + + f.Fuzz(func(t *testing.T, b []byte) { + d.Decode(&rtp.Packet{ + Header: rtp.Header{ + Version: 2, + Marker: false, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: b, + }) + }) +} diff --git a/pkg/formatdecenc/rtplpcm/testdata/fuzz/FuzzDecoderUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 b/pkg/formatdecenc/rtplpcm/testdata/fuzz/FuzzDecoderUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 new file mode 100644 index 00000000..a96f5599 --- /dev/null +++ b/pkg/formatdecenc/rtplpcm/testdata/fuzz/FuzzDecoderUnmarshal/582528ddfad69eb57775199a43e0f9fd5c94bba343ce7bb6724d4ebafe311ed4 @@ -0,0 +1,2 @@ +go test fuzz v1 +[]byte("0") diff --git a/pkg/formatdecenc/rtpmjpeg/decoder.go b/pkg/formatdecenc/rtpmjpeg/decoder.go index 55f341d3..4d9a0acd 100644 --- a/pkg/formatdecenc/rtpmjpeg/decoder.go +++ b/pkg/formatdecenc/rtpmjpeg/decoder.go @@ -167,6 +167,10 @@ func (d *Decoder) Decode(pkt *rtp.Packet) ([]byte, time.Duration, error) { return nil, 0, ErrMorePacketsNeeded } + if d.fragmentedSize < 2 { + return nil, 0, fmt.Errorf("invalid data") + } + data := make([]byte, d.fragmentedSize) pos := 0 diff --git a/pkg/formatdecenc/rtpmjpeg/decoder_test.go b/pkg/formatdecenc/rtpmjpeg/decoder_test.go index 9cfe69ed..8ef96f52 100644 --- a/pkg/formatdecenc/rtpmjpeg/decoder_test.go +++ b/pkg/formatdecenc/rtpmjpeg/decoder_test.go @@ -527,3 +527,22 @@ func TestDecode(t *testing.T) { }) } } + +func FuzzDecoderUnmarshal(f *testing.F) { + d := &Decoder{} + d.Init() + + f.Fuzz(func(t *testing.T, b []byte, m bool) { + d.Decode(&rtp.Packet{ + Header: rtp.Header{ + Version: 2, + Marker: m, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: b, + }) + }) +} diff --git a/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 new file mode 100644 index 00000000..53d50f6b --- /dev/null +++ b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0") +bool(false) diff --git a/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/76a6865e7bb36d841a943abed143b3403b2d0ffaecdf3298988189c118ee10c1 b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/76a6865e7bb36d841a943abed143b3403b2d0ffaecdf3298988189c118ee10c1 new file mode 100644 index 00000000..bbe3013d --- /dev/null +++ b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/76a6865e7bb36d841a943abed143b3403b2d0ffaecdf3298988189c118ee10c1 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0\x00\x00\x00\x01\xff000\x00\x00@0000000000000000000000000000000000000000000000000000000000000000") +bool(true) diff --git a/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/bbed53e53be4cad7bab7f568e12dda0590d7c11c0f890b3816ab6eff536ac9fc b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/bbed53e53be4cad7bab7f568e12dda0590d7c11c0f890b3816ab6eff536ac9fc new file mode 100644 index 00000000..4c74b177 --- /dev/null +++ b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/bbed53e53be4cad7bab7f568e12dda0590d7c11c0f890b3816ab6eff536ac9fc @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0000\x01\xff00000000000000000000000000000000000000000000000000000000000000000000000") +bool(true) diff --git a/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/be012bfe6e99e126df96e194dc125f8c57860dd62c4244dd7b4e7512cb22a205 b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/be012bfe6e99e126df96e194dc125f8c57860dd62c4244dd7b4e7512cb22a205 new file mode 100644 index 00000000..ad13be79 --- /dev/null +++ b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/be012bfe6e99e126df96e194dc125f8c57860dd62c4244dd7b4e7512cb22a205 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0000\x01\xff00") +bool(false) diff --git a/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/c2ffebd2c319dea9e791ab793c970d84bc212c35134cc2dfb85aa7d862858a49 b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/c2ffebd2c319dea9e791ab793c970d84bc212c35134cc2dfb85aa7d862858a49 new file mode 100644 index 00000000..59a71b35 --- /dev/null +++ b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/c2ffebd2c319dea9e791ab793c970d84bc212c35134cc2dfb85aa7d862858a49 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0\x00\x00\x00\x01\xff00") +bool(false) diff --git a/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/fe09b7699690e38a634478835482b418adf4885a063409efe36d0d6120af5eb9 b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/fe09b7699690e38a634478835482b418adf4885a063409efe36d0d6120af5eb9 new file mode 100644 index 00000000..0283daf9 --- /dev/null +++ b/pkg/formatdecenc/rtpmjpeg/testdata/fuzz/FuzzDecoderUnmarshal/fe09b7699690e38a634478835482b418adf4885a063409efe36d0d6120af5eb9 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0000\x01\xff00000000000000000000000000000000000000000000000000000000000000000000000") +bool(false) diff --git a/pkg/formatdecenc/rtpmpeg4audio/decoder_test.go b/pkg/formatdecenc/rtpmpeg4audio/decoder_test.go index a5d65c44..e414b107 100644 --- a/pkg/formatdecenc/rtpmpeg4audio/decoder_test.go +++ b/pkg/formatdecenc/rtpmpeg4audio/decoder_test.go @@ -579,226 +579,26 @@ func TestDecodeADTS(t *testing.T) { } } -func TestDecodeErrors(t *testing.T) { - for _, ca := range []struct { - name string - pkts []*rtp.Packet - err string - }{ - { - "missing payload", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - }, - }, - "payload is too short", - }, - { - "missing au header", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x00, 0x10}, - }, - }, - "not enough bits", - }, - { - "missing au", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x00, 0x10, 0x0a, 0xd8}, - }, - }, - "payload is too short", - }, - { - "invalid au headers length", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x00, 0x00}, - }, - }, - "invalid AU-headers-length", - }, - { - "au index not zero", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x00, 0x10, 0x0a, 0xd9}, - }, - }, - "AU-index different than zero is not supported", - }, - { - "au index delta not zero", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x00, 0x20, 0x00, 0x08, 0x0a, 0xd9}, - }, - }, - "AU-index-delta different than zero is not supported", - }, - { - "fragmented with multiple AUs in 1st packet", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 0x60, - SequenceNumber: 0xea2, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x00, 0x20, 0x00, 0x08, 0x00, 0x08}, - }, - }, - "a fragmented packet can only contain one AU", - }, - { - "fragmented with no payload in 1st packet", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x00, 0x10, 0x0a, 0xd8}, - }, - }, - "payload is too short", - }, - { - "fragmented with multiple AUs in 2nd packet", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x0, 0x10, 0x2d, 0x80}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 0x60, - SequenceNumber: 0x44ee, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x0, 0x20, 0x00, 0x08, 0x00, 0x08}, - ), - }, - }, - "a fragmented packet can only contain one AU", - }, - { - "fragmented with no payload in 2nd packet", - []*rtp.Packet{ - { - Header: rtp.Header{ - Version: 2, - Marker: false, - PayloadType: 0x60, - SequenceNumber: 0x44ed, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: mergeBytes( - []byte{0x0, 0x10, 0x2d, 0x80}, - bytes.Repeat([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}, 182), - ), - }, - { - Header: rtp.Header{ - Version: 2, - Marker: true, - PayloadType: 0x60, - SequenceNumber: 0x44ee, - Timestamp: 0x88776a15, - SSRC: 0x9dbb7812, - }, - Payload: []byte{0x00, 0x10, 0x0a, 0xd8}, - }, - }, - "payload is too short", - }, - } { - t.Run(ca.name, func(t *testing.T) { - d := &Decoder{ - SampleRate: 48000, - SizeLength: 13, - IndexLength: 3, - IndexDeltaLength: 3, - } - d.Init() - - var lastErr error - for _, pkt := range ca.pkts { - _, _, lastErr = d.Decode(pkt) - } - require.EqualError(t, lastErr, ca.err) - }) +func FuzzDecoderUnmarshal(f *testing.F) { + d := &Decoder{ + SampleRate: 16000, + SizeLength: 13, + IndexLength: 3, + IndexDeltaLength: 3, } + d.Init() + + f.Fuzz(func(t *testing.T, b []byte, m bool) { + d.Decode(&rtp.Packet{ + Header: rtp.Header{ + Version: 2, + Marker: m, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: b, + }) + }) } diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/17b3f3cab1067ee0ee8464bd3f7890cc1a42ed3f47f13ee83ffdc3ddec1879ef b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/17b3f3cab1067ee0ee8464bd3f7890cc1a42ed3f47f13ee83ffdc3ddec1879ef new file mode 100644 index 00000000..41e904d6 --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/17b3f3cab1067ee0ee8464bd3f7890cc1a42ed3f47f13ee83ffdc3ddec1879ef @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\x00\x0100") +bool(false) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/17f38ee4db10b1296a5bdbd03e35ab29e7e86c1008f89d4437529302df6ecb59 b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/17f38ee4db10b1296a5bdbd03e35ab29e7e86c1008f89d4437529302df6ecb59 new file mode 100644 index 00000000..1f256e22 --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/17f38ee4db10b1296a5bdbd03e35ab29e7e86c1008f89d4437529302df6ecb59 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("000001") +bool(false) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/38d1a2c06720135e2d5accd1afc1f312bc4b6991cd97c1444c86690b4ed6df70 b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/38d1a2c06720135e2d5accd1afc1f312bc4b6991cd97c1444c86690b4ed6df70 new file mode 100644 index 00000000..1075fee9 --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/38d1a2c06720135e2d5accd1afc1f312bc4b6991cd97c1444c86690b4ed6df70 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\x000000000") +bool(true) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/4c3e593e59c1f853f845a7e3c992d1837f63c5052d805c21db6734a64c3ee1e0 b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/4c3e593e59c1f853f845a7e3c992d1837f63c5052d805c21db6734a64c3ee1e0 new file mode 100644 index 00000000..21407995 --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/4c3e593e59c1f853f845a7e3c992d1837f63c5052d805c21db6734a64c3ee1e0 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\x00\x00") +bool(true) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 new file mode 100644 index 00000000..53d50f6b --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0") +bool(false) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/7b9886f07cd0d1b52d80762d475eda9b446e4861160e9a79b294eeb75345ebc5 b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/7b9886f07cd0d1b52d80762d475eda9b446e4861160e9a79b294eeb75345ebc5 new file mode 100644 index 00000000..18b04a4b --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/7b9886f07cd0d1b52d80762d475eda9b446e4861160e9a79b294eeb75345ebc5 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0001") +bool(true) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/82ab2d91fd10f5f409473e000b93d979dcea2547839dece510544e4f2243b80b b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/82ab2d91fd10f5f409473e000b93d979dcea2547839dece510544e4f2243b80b new file mode 100644 index 00000000..0fd3a327 --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/82ab2d91fd10f5f409473e000b93d979dcea2547839dece510544e4f2243b80b @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("00") +bool(true) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/a253c894d4f7ea0c24ff61014f52a33011acd37d246b6e81527f5544c00140b6 b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/a253c894d4f7ea0c24ff61014f52a33011acd37d246b6e81527f5544c00140b6 new file mode 100644 index 00000000..ed018f35 --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/a253c894d4f7ea0c24ff61014f52a33011acd37d246b6e81527f5544c00140b6 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\x00\x0100") +bool(true) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/a2d4352b624b7e9e5fefbc9881be89bcf82806ed6644dbb3c0914215e484c015 b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/a2d4352b624b7e9e5fefbc9881be89bcf82806ed6644dbb3c0914215e484c015 new file mode 100644 index 00000000..287c2699 --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/a2d4352b624b7e9e5fefbc9881be89bcf82806ed6644dbb3c0914215e484c015 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\x00\x10\x80\x00") +bool(false) diff --git a/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/fc47c4c80ffd62dfd9c7adf40b38f9d9fe0bf9466af436b5c3487f2c4b9b90e4 b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/fc47c4c80ffd62dfd9c7adf40b38f9d9fe0bf9466af436b5c3487f2c4b9b90e4 new file mode 100644 index 00000000..f1cd9e57 --- /dev/null +++ b/pkg/formatdecenc/rtpmpeg4audio/testdata/fuzz/FuzzDecoderUnmarshal/fc47c4c80ffd62dfd9c7adf40b38f9d9fe0bf9466af436b5c3487f2c4b9b90e4 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("\x000000000") +bool(false) diff --git a/pkg/formatdecenc/rtpvp8/decoder_test.go b/pkg/formatdecenc/rtpvp8/decoder_test.go index 67822475..d70f29cb 100644 --- a/pkg/formatdecenc/rtpvp8/decoder_test.go +++ b/pkg/formatdecenc/rtpvp8/decoder_test.go @@ -131,3 +131,22 @@ func TestDecode(t *testing.T) { }) } } + +func FuzzDecoderUnmarshal(f *testing.F) { + d := &Decoder{} + d.Init() + + f.Fuzz(func(t *testing.T, b []byte, m bool) { + d.Decode(&rtp.Packet{ + Header: rtp.Header{ + Version: 2, + Marker: m, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: b, + }) + }) +} diff --git a/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 b/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 new file mode 100644 index 00000000..53d50f6b --- /dev/null +++ b/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/52b2e47791e6e8c660670149d685c83d5fecefd94c322f710147669ef887e099 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("0") +bool(false) diff --git a/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/7a1c68afba07c13a12f3686c52a228b2ca8d9794363a61529fcad02658ea03e3 b/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/7a1c68afba07c13a12f3686c52a228b2ca8d9794363a61529fcad02658ea03e3 new file mode 100644 index 00000000..3a967e37 --- /dev/null +++ b/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/7a1c68afba07c13a12f3686c52a228b2ca8d9794363a61529fcad02658ea03e3 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte(" 000") +bool(false) diff --git a/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/c4c11fb7d7de62a02ee8e7d6962d074d82fa5fdd472096dc3ba35696d1649fa4 b/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/c4c11fb7d7de62a02ee8e7d6962d074d82fa5fdd472096dc3ba35696d1649fa4 new file mode 100644 index 00000000..da84ddf8 --- /dev/null +++ b/pkg/formatdecenc/rtpvp8/testdata/fuzz/FuzzDecoderUnmarshal/c4c11fb7d7de62a02ee8e7d6962d074d82fa5fdd472096dc3ba35696d1649fa4 @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("1000") +bool(false) diff --git a/pkg/formatdecenc/rtpvp9/decoder_test.go b/pkg/formatdecenc/rtpvp9/decoder_test.go index 16ea2f25..682b6b7e 100644 --- a/pkg/formatdecenc/rtpvp9/decoder_test.go +++ b/pkg/formatdecenc/rtpvp9/decoder_test.go @@ -132,3 +132,22 @@ func TestDecode(t *testing.T) { }) } } + +func FuzzDecoderUnmarshal(f *testing.F) { + d := &Decoder{} + d.Init() + + f.Fuzz(func(t *testing.T, b []byte, m bool) { + d.Decode(&rtp.Packet{ + Header: rtp.Header{ + Version: 2, + Marker: m, + PayloadType: 96, + SequenceNumber: 17645, + Timestamp: 2289527317, + SSRC: 0x9dbb7812, + }, + Payload: b, + }) + }) +} diff --git a/pkg/formatdecenc/rtpvp9/testdata/fuzz/FuzzDecoderUnmarshal/a562b457d1a04bb296308020307f2e271491c804e84959ad2d5fdaa2e32b6a0f b/pkg/formatdecenc/rtpvp9/testdata/fuzz/FuzzDecoderUnmarshal/a562b457d1a04bb296308020307f2e271491c804e84959ad2d5fdaa2e32b6a0f new file mode 100644 index 00000000..0d61da40 --- /dev/null +++ b/pkg/formatdecenc/rtpvp9/testdata/fuzz/FuzzDecoderUnmarshal/a562b457d1a04bb296308020307f2e271491c804e84959ad2d5fdaa2e32b6a0f @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("") +bool(true) diff --git a/pkg/formatdecenc/rtpvp9/testdata/fuzz/FuzzDecoderUnmarshal/ef9d289981397c05db640a6c59c3451a32320b9343d5fefb3e03f72b36377a6c b/pkg/formatdecenc/rtpvp9/testdata/fuzz/FuzzDecoderUnmarshal/ef9d289981397c05db640a6c59c3451a32320b9343d5fefb3e03f72b36377a6c new file mode 100644 index 00000000..0e38cb16 --- /dev/null +++ b/pkg/formatdecenc/rtpvp9/testdata/fuzz/FuzzDecoderUnmarshal/ef9d289981397c05db640a6c59c3451a32320b9343d5fefb3e03f72b36377a6c @@ -0,0 +1,3 @@ +go test fuzz v1 +[]byte("00") +bool(false)