Skip to content

Commit 508d025

Browse files
authored
prevent decoders from emitting corrupted frames (#638)
1 parent f41b196 commit 508d025

21 files changed

+647
-13
lines changed

pkg/format/rtpac3/decoder.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type Decoder struct {
3535
fragments [][]byte
3636
fragmentsSize int
3737
fragmentsExpected int
38+
fragmentNextSeqNum uint16
3839
}
3940

4041
// Init initializes the decoder.
@@ -106,6 +107,7 @@ func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, error) {
106107
d.fragmentsSize = le
107108
d.fragmentsExpected = size - le
108109
d.fragments = append(d.fragments, pkt.Payload[2:])
110+
d.fragmentNextSeqNum = pkt.SequenceNumber + 1
109111
d.firstPacketReceived = true
110112

111113
return nil, ErrMorePacketsNeeded
@@ -118,6 +120,11 @@ func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, error) {
118120
return nil, fmt.Errorf("received a subsequent fragment without previous fragments")
119121
}
120122

123+
if pkt.SequenceNumber != d.fragmentNextSeqNum {
124+
d.resetFragments()
125+
return nil, fmt.Errorf("discarding frame since a RTP packet is missing")
126+
}
127+
121128
le := len(pkt.Payload[2:])
122129
d.fragmentsSize += le
123130
d.fragmentsExpected -= le
@@ -128,6 +135,7 @@ func (d *Decoder) Decode(pkt *rtp.Packet) ([][]byte, error) {
128135
}
129136

130137
d.fragments = append(d.fragments, pkt.Payload[2:])
138+
d.fragmentNextSeqNum++
131139

132140
if d.fragmentsExpected > 0 {
133141
return nil, ErrMorePacketsNeeded

pkg/format/rtpac3/decoder_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,40 @@ func TestDecode(t *testing.T) {
3838
}
3939
}
4040

41+
func TestDecodeErrorMissingPacket(t *testing.T) {
42+
d := &Decoder{}
43+
err := d.Init()
44+
require.NoError(t, err)
45+
46+
_, err = d.Decode(&rtp.Packet{
47+
Header: rtp.Header{
48+
Version: 2,
49+
Marker: false,
50+
PayloadType: 96,
51+
SequenceNumber: 17645,
52+
SSRC: 0x9dbb7812,
53+
},
54+
Payload: []byte{
55+
0x01, 0x02, 0x0b, 0x77, 0x1a, 0x01, 0x1e, 0x40,
56+
},
57+
})
58+
require.Equal(t, ErrMorePacketsNeeded, err)
59+
60+
_, err = d.Decode(&rtp.Packet{
61+
Header: rtp.Header{
62+
Version: 2,
63+
Marker: false,
64+
PayloadType: 96,
65+
SequenceNumber: 17647,
66+
SSRC: 0x9dbb7812,
67+
},
68+
Payload: []byte{
69+
0x03, 0x02, 0x72, 0xdc, 0x06, 0x7d, 0x2d, 0xe5,
70+
},
71+
})
72+
require.EqualError(t, err, "discarding frame since a RTP packet is missing")
73+
}
74+
4175
func FuzzDecoder(f *testing.F) {
4276
f.Fuzz(func(t *testing.T, a []byte, am bool, b []byte, bm bool) {
4377
d := &Decoder{}

pkg/format/rtpav1/decoder.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ func joinFragments(fragments [][]byte, size int) []byte {
3232
// Specification: https://aomediacodec.github.io/av1-rtp-spec/
3333
type Decoder struct {
3434
firstPacketReceived bool
35-
fragmentsSize int
3635
fragments [][]byte
36+
fragmentsSize int
37+
fragmentNextSeqNum uint16
3738

3839
// for Decode()
3940
frameBuffer [][]byte
@@ -68,14 +69,21 @@ func (d *Decoder) decodeOBUs(pkt *rtp.Packet) ([][]byte, error) {
6869
return nil, fmt.Errorf("received a subsequent fragment without previous fragments")
6970
}
7071

72+
if pkt.SequenceNumber != d.fragmentNextSeqNum {
73+
d.resetFragments()
74+
return nil, fmt.Errorf("discarding frame since a RTP packet is missing")
75+
}
76+
7177
d.fragmentsSize += len(av1header.OBUElements[0])
78+
7279
if d.fragmentsSize > av1.MaxTemporalUnitSize {
7380
d.resetFragments()
74-
return nil, fmt.Errorf("OBU size (%d) is too big, maximum is %d", d.fragmentsSize, av1.MaxTemporalUnitSize)
81+
return nil, fmt.Errorf("temporal unit size (%d) is too big, maximum is %d", d.fragmentsSize, av1.MaxTemporalUnitSize)
7582
}
7683

7784
d.fragments = append(d.fragments, av1header.OBUElements[0])
7885
av1header.OBUElements = av1header.OBUElements[1:]
86+
d.fragmentNextSeqNum++
7987
}
8088

8189
d.firstPacketReceived = true
@@ -95,11 +103,12 @@ func (d *Decoder) decodeOBUs(pkt *rtp.Packet) ([][]byte, error) {
95103

96104
if d.fragmentsSize > av1.MaxTemporalUnitSize {
97105
d.resetFragments()
98-
return nil, fmt.Errorf("OBU size (%d) is too big, maximum is %d", d.fragmentsSize, av1.MaxTemporalUnitSize)
106+
return nil, fmt.Errorf("temporal unit size (%d) is too big, maximum is %d", d.fragmentsSize, av1.MaxTemporalUnitSize)
99107
}
100108

101109
d.fragments = append(d.fragments, av1header.OBUElements[elementCount-1])
102110
av1header.OBUElements = av1header.OBUElements[:elementCount-1]
111+
d.fragmentNextSeqNum = pkt.SequenceNumber + 1
103112
}
104113

105114
obus = append(obus, av1header.OBUElements...)

pkg/format/rtpav1/decoder_test.go

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,245 @@ func TestDecoderErrorLimit(t *testing.T) {
5555
require.EqualError(t, err, "OBU count exceeds maximum allowed (10)")
5656
}
5757

58+
func TestDecodeErrorMissingPacket(t *testing.T) {
59+
d := &Decoder{}
60+
err := d.Init()
61+
require.NoError(t, err)
62+
63+
_, err = d.Decode(&rtp.Packet{
64+
Header: rtp.Header{
65+
Version: 2,
66+
Marker: false,
67+
PayloadType: 96,
68+
SequenceNumber: 17645,
69+
SSRC: 0x9dbb7812,
70+
},
71+
Payload: []byte{
72+
0x40, 0xb1, 0x0b, 0x30, 0x30, 0xca, 0x08, 0x12,
73+
0xfd, 0xfd, 0x78, 0x89, 0xe5, 0x3e, 0xa3, 0x80,
74+
0x08, 0x20, 0x82, 0x08, 0x54, 0x50, 0x00, 0x30,
75+
0x00, 0x00, 0x66, 0x00, 0xeb, 0xcd, 0xc5, 0x72,
76+
0x25, 0x5a, 0x0a, 0xc3, 0x4a, 0x43, 0x15, 0x59,
77+
0x13, 0x5f, 0xb9, 0x39, 0x19, 0xf1, 0xca, 0x26,
78+
0xc7, 0x59, 0xa7, 0x66, 0xe4, 0xa5, 0xff, 0x3a,
79+
0xba, 0x3f, 0x62, 0xfc, 0x58, 0x07, 0xd0, 0x18,
80+
0xd6, 0xb2, 0x90, 0x72, 0xf4, 0x57, 0xbd, 0x5d,
81+
0x72, 0x92, 0x8c, 0x71, 0x48, 0x17, 0x89, 0x65,
82+
0xa9, 0x9e, 0xa2, 0x81, 0x9a, 0x83, 0x66, 0x11,
83+
0xd7, 0xe7, 0x41, 0x35, 0xb7, 0x8a, 0xb3, 0xd0,
84+
0x90, 0x54, 0x2a, 0x48, 0xea, 0x65, 0xd1, 0xb0,
85+
0x83, 0xda, 0xbb, 0x61, 0xff, 0xc4, 0xd0, 0x06,
86+
0x78, 0x35, 0xc2, 0xf7, 0x15, 0x16, 0xe5, 0xc3,
87+
0xf0, 0x9f, 0x7f, 0x1a, 0xd6, 0xad, 0xd4, 0x41,
88+
0xa4, 0xf4, 0x40, 0x41, 0x00, 0x78, 0x5c, 0x14,
89+
0x08, 0x57, 0x3d, 0x96, 0xc2, 0x0b, 0xb5, 0x03,
90+
0xce, 0x7d, 0xe6, 0x50, 0xd1, 0xbc, 0x3e, 0x1e,
91+
0x84, 0x62, 0x1a, 0xd1, 0xfe, 0x52, 0x9e, 0x79,
92+
0x26, 0x51, 0xc8, 0x14, 0x54, 0xf2, 0x77, 0xe6,
93+
0x25, 0x0f, 0x5f, 0xec, 0x66, 0x33, 0xdb, 0xd0,
94+
0x9f, 0x5a, 0xf9, 0xbc, 0xc4, 0x9b, 0x31, 0x8c,
95+
0x6f, 0xe6, 0x2a, 0x50, 0x65, 0x1d, 0x45, 0xaf,
96+
0x19, 0xd4, 0xde, 0xf8, 0x33, 0x43, 0x48, 0x57,
97+
0x00, 0x80, 0x5b, 0xaa, 0x3e, 0x1b, 0xf7, 0x21,
98+
0xc1, 0x56, 0x5e, 0xfb, 0xdb, 0x43, 0xa8, 0x7b,
99+
0xde, 0x82, 0xc1, 0x45, 0x5a, 0x36, 0x04, 0x20,
100+
0xa8, 0xa3, 0x0b, 0xa9, 0xa8, 0x6d, 0xe1, 0xfd,
101+
0x13, 0x0d, 0x38, 0xef, 0x00, 0xd5, 0x00, 0xe5,
102+
0x2d, 0x69, 0x67, 0x17, 0x59, 0xd9, 0xda, 0x61,
103+
0x95, 0xac, 0x55, 0x3a, 0xc5, 0x77, 0x1e, 0xbe,
104+
0xa5, 0x58, 0x7a, 0xbb, 0x09, 0xbd, 0x46, 0xab,
105+
0x82, 0x60, 0x13, 0x8f, 0x8b, 0xfb, 0x29, 0xe0,
106+
0x7f, 0xa5, 0xca, 0x25, 0xfa, 0x77, 0x07, 0x88,
107+
0x51, 0xdb, 0xc2, 0x99, 0x5f, 0xad, 0xe1, 0x45,
108+
0x28, 0x0e, 0x00, 0x86, 0x79, 0x60, 0xe2, 0x36,
109+
0x9a, 0x41, 0x21, 0x01, 0xdf, 0x3d, 0x0c, 0x31,
110+
0x37, 0xa4, 0x0b, 0x00, 0xe6, 0x43, 0xfb, 0x28,
111+
0x05, 0x2c, 0xff, 0x40, 0x1c, 0x23, 0x6d, 0x4f,
112+
0x58, 0x00, 0xe1, 0xc4, 0xb2, 0x05, 0x3a, 0x03,
113+
0xa4, 0xde, 0xf4, 0x13, 0x5e, 0x8c, 0x45, 0xc2,
114+
0x3b, 0xf0, 0x2c, 0x00, 0x28, 0x0b, 0xe2, 0x7d,
115+
0xa4, 0x27, 0x78, 0xf0, 0xfa, 0x3f, 0x0a, 0xa9,
116+
0xac, 0x20, 0xa0, 0xe2, 0x33, 0xe8, 0xc6, 0xa7,
117+
0x69, 0x6f, 0x4c, 0xec, 0x67, 0x06, 0x79, 0x27,
118+
0x1d, 0x69, 0xe3, 0xa6, 0xad, 0x6e, 0x63, 0x97,
119+
0xd2, 0xe3, 0xaa, 0xd4, 0xc5, 0x6d, 0xaa, 0x29,
120+
0xfa, 0xc3, 0x4b, 0x23, 0xec, 0xe7, 0x5f, 0xdd,
121+
0xf8, 0x45, 0x55, 0x62, 0xec, 0x3c, 0xe8, 0x73,
122+
0xf0, 0x63, 0x04, 0x6f, 0x88, 0xa7, 0x4d, 0x7c,
123+
0x28, 0xef, 0x20, 0x0d, 0x00, 0xf9, 0xba, 0xe5,
124+
0x09, 0x5d, 0xc2, 0x8d, 0x7d, 0x18, 0x2c, 0x2f,
125+
0xff, 0x93, 0x88, 0x2d, 0x00, 0xf9, 0xaf, 0x22,
126+
0x68, 0x70, 0x72, 0xe4, 0x36, 0x22, 0x15, 0x5f,
127+
0x7a, 0xef, 0xd9, 0x03, 0x25, 0xf5, 0x17, 0x68,
128+
0x30, 0xee, 0x2b, 0xed, 0xe8, 0x0c, 0x1a, 0x32,
129+
0x72, 0x62, 0xd4, 0x74, 0x69, 0xf1, 0x9a, 0xcf,
130+
0x9b, 0x52, 0xfc, 0x56, 0xe3, 0xda, 0x73, 0x09,
131+
0x33, 0x95, 0x08, 0x77, 0x00, 0x09, 0x17, 0x4d,
132+
0xb7, 0xc4, 0x32, 0xcd, 0xf9, 0x33, 0x7f, 0x78,
133+
0x44, 0x33, 0xf3, 0x94, 0x5d, 0x74, 0x14, 0x53,
134+
0x3e, 0xc1, 0xa6, 0x62, 0x3a, 0x94, 0x41, 0xc9,
135+
0x4d, 0x05, 0x87, 0x7d, 0x92, 0xd9, 0x12, 0xb4,
136+
0x9a, 0x1f, 0x43, 0xf4, 0x54, 0x0c, 0xb4, 0x6c,
137+
0xd0, 0x16, 0xd7, 0x46, 0xe2, 0x5e, 0xdc, 0x56,
138+
0xff, 0x42, 0x72, 0xe4, 0x97, 0x8f, 0xdb, 0x2f,
139+
0x27, 0xbd, 0x4c, 0xa3, 0x4e, 0x43, 0x4a, 0x0b,
140+
0x46, 0x45, 0x36, 0x80, 0x0d, 0xd4, 0x87, 0xc7,
141+
0x1a, 0xf8, 0x5f, 0x9c, 0xf4, 0x10, 0x82, 0xa8,
142+
0x28, 0xa7, 0xd1, 0xbf, 0xc1, 0x61, 0x5a, 0x73,
143+
0xbd, 0xe9, 0x44, 0x66, 0x5a, 0x2b, 0x14, 0x4c,
144+
0xa5, 0x5d, 0x3d, 0x38, 0xfb, 0xd4, 0xa8, 0x24,
145+
0xbe, 0xe4, 0x99, 0xa1, 0x98, 0x90, 0x72, 0x67,
146+
0x1f, 0x3b, 0x96, 0xae, 0x60, 0x7a, 0x00, 0xf2,
147+
0x11, 0x13, 0x9f, 0xc4, 0xb5, 0x63, 0xd7, 0x63,
148+
0xb6, 0x64, 0xe3, 0xbb, 0xf1, 0x96, 0x9e, 0x77,
149+
0xab, 0xc4, 0xa8, 0x39, 0xd5, 0x22, 0xe9, 0xee,
150+
0xad, 0x1f, 0x91, 0xff, 0x56, 0x3e, 0x68, 0x89,
151+
0x63, 0x11, 0xc8, 0x98, 0xa1, 0x7e, 0xd9, 0x37,
152+
0xb2, 0x94, 0x23, 0xfb, 0x67, 0xb7, 0xa0, 0xaa,
153+
0x0f, 0xe7, 0xb6, 0xe1, 0xb8, 0xc3, 0x73, 0xe3,
154+
0xae, 0x07, 0xe6, 0xf7, 0xc8, 0x35, 0x03, 0xc5,
155+
0x7a, 0xfc, 0x48, 0xd4, 0xe2, 0x61, 0x7a, 0x22,
156+
0xdd, 0x78, 0x4b, 0xef, 0xa4, 0xde, 0x27, 0x62,
157+
0xdd, 0xa1, 0x76, 0xe5, 0xeb, 0x83, 0xa3, 0x18,
158+
0xde, 0xe9, 0x99, 0x37, 0x66, 0x34, 0x20, 0xaf,
159+
0x67, 0x2b, 0xdd, 0xa4, 0x69, 0xeb, 0x7d, 0x71,
160+
0x0f, 0x24, 0xef, 0x88, 0x49, 0x8c, 0xe5, 0x33,
161+
0xfa, 0xf3, 0x3e, 0xff, 0x46, 0x10, 0x5d, 0x25,
162+
0x97, 0x7f, 0x8e, 0x00, 0xe2, 0x08, 0x0e, 0x39,
163+
0x65, 0x4c, 0xa5, 0x1b, 0x5f, 0x5a, 0xa8, 0xab,
164+
0xb1, 0x4a, 0x55, 0xf0, 0x41, 0x9e, 0xf5, 0xcd,
165+
0x2c, 0x34, 0x56, 0x11, 0xda, 0x96, 0x68, 0xe4,
166+
0x39, 0x8d, 0xfe, 0x40, 0xb0, 0x0b, 0x05, 0x5d,
167+
0xf4, 0xba, 0x27, 0x1a, 0x3b, 0xed, 0xee, 0x88,
168+
0x07, 0x59, 0x40, 0xf6, 0x6f, 0x44, 0x1a, 0x5f,
169+
0x3d, 0x42, 0xb2, 0xa7, 0x5d, 0x07, 0xd5, 0x7e,
170+
0x95, 0x36, 0xc9, 0xa3, 0xd3, 0x45, 0x56, 0x70,
171+
0x92, 0x79, 0xc9, 0xd7, 0xfd, 0x88, 0xa4, 0x89,
172+
0x9a, 0x94, 0xbd, 0x9d, 0x49, 0xec, 0x32, 0xc4,
173+
0xee, 0x87, 0xd7, 0x0a, 0xf8, 0xab, 0x23, 0x70,
174+
0x3b, 0xbd, 0xd6, 0x34, 0x86, 0x3a, 0x05, 0x68,
175+
0x95, 0x31, 0x81, 0x2d, 0x6d, 0xde, 0x54, 0xfe,
176+
0x0b, 0xa9, 0x72, 0x3c, 0x78, 0xb7, 0xf5, 0x84,
177+
0x67, 0x39, 0x4f, 0x2d, 0xbb, 0xcb, 0x22, 0x2d,
178+
0xed, 0xf2, 0xc1, 0x56, 0xf8, 0x11, 0xf9, 0xee,
179+
0x81, 0xd8, 0x64, 0x07, 0xbf, 0xb4, 0x69, 0xdb,
180+
0xda, 0x0c, 0xf5, 0x20, 0x00, 0xf8, 0x26, 0x7b,
181+
0x31, 0x54, 0x09, 0x24, 0xbf, 0x7c, 0xf5, 0xad,
182+
0x76, 0xbb, 0xcc, 0x89, 0xee, 0x5b, 0x2a, 0x23,
183+
0x12, 0x1c, 0x69, 0x50, 0xdd, 0x03, 0x0d, 0xe4,
184+
0xca, 0xb8, 0x59, 0x7c, 0x91, 0xa0, 0x82, 0x00,
185+
0x01, 0x9e, 0x1e, 0x4d, 0x87, 0xf7, 0xab, 0x3d,
186+
0x06, 0x6c, 0x95, 0x90, 0x63, 0x57, 0x0f, 0x44,
187+
0x4c, 0x49, 0x21, 0x2e, 0x85, 0x47, 0x61, 0x02,
188+
0x67, 0x57, 0xdc, 0xde, 0x67, 0x92, 0x11, 0x34,
189+
0x85, 0x05, 0x9e, 0x25, 0xe4, 0x1b, 0x8e, 0xaa,
190+
0xca, 0xd9, 0x4c, 0x2c, 0x84, 0x30, 0xf1, 0xdc,
191+
0x4a, 0x9b, 0x02, 0xdd, 0x69, 0x5e, 0xcd, 0x31,
192+
0x08, 0x27, 0xd1, 0x83, 0xcd, 0x03, 0x4d, 0xd9,
193+
0xf0, 0x0a, 0x69, 0x8e, 0x8b, 0x88, 0x14, 0x98,
194+
0x37, 0x8c, 0xad, 0x93, 0x70, 0x04, 0xf8, 0x88,
195+
0xa7, 0x67, 0xf0, 0xfe, 0xa9, 0x49, 0x46, 0xbe,
196+
0xab, 0x14, 0x8c, 0x56, 0xea, 0x17, 0x52, 0x1f,
197+
0x35, 0xfa, 0xd2, 0xd4, 0xa4, 0xf6, 0xb6, 0x72,
198+
0x25, 0x03, 0xbf, 0xc1, 0x85, 0xe1, 0x3e, 0x3a,
199+
0x19, 0xcb, 0xe3, 0x7e, 0x15, 0x65, 0xd1, 0x33,
200+
0x40, 0x2a, 0xd8, 0x3f, 0x2c, 0x86, 0x12, 0x65,
201+
0xe2, 0x60, 0x80, 0x1b, 0x01, 0x0b, 0xd2, 0xcd,
202+
0x3b, 0x24, 0x56, 0x73, 0xcd, 0xa9, 0x34, 0xd1,
203+
0x36, 0xd3, 0x26, 0x6f, 0x49, 0x58, 0xcf, 0xb7,
204+
0x39, 0x92, 0xa8, 0x15, 0x47, 0x0f, 0x92, 0x68,
205+
0x49, 0xa2, 0x91, 0xe0, 0x55, 0xc8, 0xd9, 0xf1,
206+
0x84, 0xc4, 0x41, 0x67, 0xd9, 0x24, 0xf3, 0x0f,
207+
0xdc, 0x3d, 0x6d, 0x79, 0x4d, 0x0f, 0x35, 0x8b,
208+
0xdf, 0x6d, 0xcd, 0x66, 0x7e, 0x82, 0x09, 0xa3,
209+
0x72, 0x1d, 0x3d, 0x4b, 0x0f, 0xad, 0x7c, 0xbe,
210+
0xdd, 0x96, 0x17, 0x62, 0x26, 0x72, 0xe6, 0x1d,
211+
0xb9, 0xf6, 0x9a, 0x71, 0x52, 0x5a, 0x76, 0xbb,
212+
0x4e, 0x11, 0x78, 0xbe, 0x05, 0xe5, 0xf6, 0xaf,
213+
0xf2, 0x66, 0xd3, 0xe5, 0xdb, 0xfc, 0xd8, 0x96,
214+
0x64, 0x8b, 0x7a, 0xec, 0x9f, 0x3e, 0x0d, 0x7c,
215+
0xd5, 0x20, 0xdf, 0x50, 0x52, 0x57, 0x93, 0xa0,
216+
0x03, 0x5a, 0xed, 0x5c, 0xb4, 0xfa, 0x15, 0xf0,
217+
0xda, 0xc4, 0x94, 0xbf, 0xcb, 0x25, 0xc7, 0xda,
218+
0x59, 0x5d, 0xb8, 0x00, 0x00, 0x00, 0x56, 0x76,
219+
0xe4, 0x62, 0x1c, 0x71, 0x70, 0xf6, 0x7f, 0x20,
220+
0x83, 0xee, 0x17, 0x23, 0x56, 0x8c, 0x20, 0x9c,
221+
0x65, 0x25, 0xe9, 0x38, 0xe2, 0xd2, 0x66, 0xae,
222+
0xa1, 0x47, 0x16, 0xba, 0x5e, 0x87, 0xd4, 0x8b,
223+
0x7e, 0x80, 0x9f, 0x83, 0x4b, 0x27, 0x46, 0x97,
224+
0x72, 0x2b, 0x88, 0xd1, 0xf0, 0x92, 0xd4, 0x2a,
225+
0x7e, 0x48, 0x63, 0x95, 0x33, 0x13, 0x07, 0xf8,
226+
0x79, 0x3a, 0x6b, 0x67, 0x1c, 0x6f, 0x38, 0x80,
227+
0x3c, 0xc6, 0xfa, 0xb8, 0x4e, 0xd2, 0x01, 0xaf,
228+
0x79, 0x37, 0x60, 0xd6, 0x4d, 0x55, 0xcd, 0x1d,
229+
0xf5, 0x15, 0x0f, 0xb7, 0x8c, 0xa5, 0xec, 0x25,
230+
0xe4, 0x45, 0xec, 0xe6, 0xf9, 0xc2, 0x35, 0xea,
231+
0xc6, 0x30, 0xa2, 0x1f, 0x21, 0x13, 0x1f, 0x97,
232+
0x95, 0xee, 0x69, 0x63, 0xcf, 0x4b, 0xb2, 0xc3,
233+
0xc0, 0x23, 0xc9, 0x75, 0x2b, 0xd6, 0xac, 0x3c,
234+
0xcb, 0x38, 0x73, 0xa0, 0x5a, 0xa5, 0x7d, 0x3d,
235+
0x23, 0xb1, 0x4c, 0xc9, 0x1b, 0x12, 0xc4, 0x83,
236+
0xe1, 0x62, 0x61, 0xf3, 0x8c, 0x6a, 0x45, 0x95,
237+
0xee, 0x74, 0x00, 0x2f, 0x84, 0x77, 0xff, 0x16,
238+
0x22, 0x02, 0xfe, 0x4b, 0xd2, 0x57, 0x65, 0xee,
239+
0x49, 0xcd, 0x7b, 0xb5, 0xdb, 0x8e, 0x5a, 0xcb,
240+
0x70, 0x7f, 0x78, 0xbc, 0x35, 0x34, 0x3e, 0xcd,
241+
0xf6, 0x24, 0x78, 0x8f, 0xe8, 0x9e, 0x5c, 0x9c,
242+
0x22, 0x4a, 0xf0, 0xbc, 0x89, 0x64, 0x93, 0xcf,
243+
0x20, 0xc8, 0xfd, 0x27, 0xe2, 0x36, 0x86, 0x00,
244+
0x61, 0xe8, 0xe2, 0x9c, 0xad, 0x55, 0x98, 0x77,
245+
0x2f, 0xfa, 0x28, 0xb4, 0xa7, 0xda, 0xa4, 0x14,
246+
0x06, 0x8c, 0x7a, 0xd5, 0xdf, 0x0d, 0x32, 0x56,
247+
0xcc, 0xd3, 0x70, 0x71, 0x70, 0xd5, 0xb6, 0x41,
248+
0x0f, 0x45, 0xb2, 0xf0, 0x24, 0xa5, 0x23, 0x13,
249+
0x70, 0x36, 0x07, 0xcd, 0xc6, 0x75, 0xd8, 0x62,
250+
0x8c, 0x7f, 0xa7, 0xb9, 0x76, 0x16, 0xb3, 0x9a,
251+
0x7e, 0x20, 0x27, 0x27, 0x2d, 0x33, 0x60, 0x70,
252+
0xa5, 0xef, 0x5c, 0x9c, 0x6e, 0x5f, 0x2f, 0x20,
253+
0x78, 0x58, 0x59, 0x92, 0x15, 0xfe, 0x13, 0x07,
254+
0x87, 0xc7, 0x3e, 0x21,
255+
},
256+
})
257+
require.Equal(t, ErrMorePacketsNeeded, err)
258+
259+
_, err = d.Decode(&rtp.Packet{
260+
Header: rtp.Header{
261+
Version: 2,
262+
Marker: false,
263+
PayloadType: 96,
264+
SequenceNumber: 17647,
265+
SSRC: 0x9dbb7812,
266+
},
267+
Payload: []byte{
268+
0x80, 0xbb, 0x01, 0x04, 0x24, 0x33, 0x60, 0x15,
269+
0x91, 0xfb, 0xfe, 0xe8, 0xf8, 0xb9, 0xa6, 0x9a,
270+
0xbf, 0x65, 0xf3, 0x37, 0x40, 0xb8, 0x52, 0x69,
271+
0x3f, 0x65, 0x27, 0x36, 0x01, 0x92, 0xe8, 0xef,
272+
0x51, 0x3e, 0xcd, 0xf5, 0xcc, 0x4f, 0x8b, 0x4f,
273+
0x7b, 0x38, 0x3e, 0x43, 0x4d, 0xc0, 0xa4, 0xc6,
274+
0x84, 0x79, 0x8e, 0xf4, 0x4a, 0xe1, 0xa9, 0x2b,
275+
0xd5, 0x34, 0x00, 0x30, 0x94, 0x6a, 0x91, 0xa2,
276+
0xd5, 0xc0, 0xbf, 0xb5, 0x66, 0x59, 0x38, 0xc2,
277+
0xa4, 0x75, 0x96, 0x5b, 0x7a, 0xac, 0x9c, 0x05,
278+
0x67, 0x99, 0x2e, 0xba, 0x21, 0x1e, 0xac, 0x50,
279+
0x01, 0x68, 0x71, 0xac, 0x68, 0x6d, 0xc1, 0xf2,
280+
0x2c, 0x51, 0x1e, 0xb6, 0x64, 0x97, 0x3d, 0x9b,
281+
0x2b, 0x89, 0x66, 0xbd, 0x50, 0x4f, 0x5c, 0xec,
282+
0x7c, 0xc8, 0x51, 0x61, 0x74, 0xbd, 0x86, 0xb4,
283+
0x6e, 0x71, 0x59, 0x24, 0x59, 0xaf, 0x66, 0x54,
284+
0x82, 0xdb, 0xe2, 0x11, 0x6f, 0x87, 0x92, 0xf3,
285+
0x63, 0xd4, 0x4b, 0xd6, 0x26, 0x42, 0xf1, 0x2a,
286+
0x66, 0x63, 0x79, 0x5e, 0x7e, 0xfb, 0x3f, 0x85,
287+
0xa7, 0x24, 0xac, 0x53, 0xe2, 0x57, 0x56, 0xdd,
288+
0xef, 0x7a, 0xdf, 0xb6, 0x27, 0xaf, 0x25, 0x6a,
289+
0x89, 0x4a, 0x4c, 0xc3, 0xe6, 0x2e, 0xbe, 0x2b,
290+
0x38, 0x07, 0xe0, 0x96, 0x98, 0xaf, 0x85, 0xf4,
291+
0x86, 0x7d, 0xf4, 0xee, 0xe5, 0x78,
292+
},
293+
})
294+
require.EqualError(t, err, "discarding frame since a RTP packet is missing")
295+
}
296+
58297
func FuzzDecoder(f *testing.F) {
59298
f.Fuzz(func(_ *testing.T, a []byte, am bool, b []byte, bm bool) {
60299
d := &Decoder{}

0 commit comments

Comments
 (0)