mirror of https://bitbucket.org/ausocean/av.git
protcol/rtp: panic in Payload if length is not sufficiently long to be RTP packet.
This commit is contained in:
parent
f52272894a
commit
ff0c62910c
|
@ -37,6 +37,9 @@ const badVer = "incompatible RTP version"
|
|||
// Payload returns the payload from an RTP packet provided the version is
|
||||
// compatible, otherwise an error is returned.
|
||||
func Payload(d []byte) ([]byte, error) {
|
||||
if len(d) < defaultHeadSize {
|
||||
panic("invalid RTP packet length")
|
||||
}
|
||||
if version(d) != rtpVer {
|
||||
return nil, errors.New(badVer)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue