feat(gateway): repair native Apollo provider path
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func FuzzApolloENetAndRTSPParsersStayBounded(f *testing.F) {
|
||||
server, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.ParseIP("127.0.0.1")})
|
||||
if err != nil {
|
||||
f.Fatal(err)
|
||||
}
|
||||
defer server.Close()
|
||||
client, err := net.DialUDP("udp", nil, server.LocalAddr().(*net.UDPAddr))
|
||||
if err != nil {
|
||||
f.Fatal(err)
|
||||
}
|
||||
defer client.Close()
|
||||
f.Add([]byte{0x80, 0x01, 0, 0, apolloENetPing | apolloENetAcknowledged, 0, 0, 1})
|
||||
f.Add([]byte("RTSP/1.0 200 OK\r\nCSeq: 1\r\n\r\n"))
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
if len(data) > apolloENetMaximumPacket+1 {
|
||||
data = data[:apolloENetMaximumPacket+1]
|
||||
}
|
||||
peer := &apolloENetPeer{
|
||||
conn: client, now: time.Now, state: apolloENetConnected, peerID: 1, inboundSession: 0,
|
||||
pending: make(map[apolloENetPendingKey]*apolloENetPending), rtt: time.Millisecond, variance: time.Millisecond,
|
||||
}
|
||||
_ = peer.handleDatagram(data)
|
||||
_, _ = parseApolloRTSPMessage(data)
|
||||
_, _ = ParseRTSPResponse(data)
|
||||
_ = validateApolloDescribe(apolloRTSPMessage{headers: map[string]string{"content-type": "application/sdp"}, body: data})
|
||||
_, _ = parseApolloRTP(data)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user