mirror of
https://github.com/pion/webrtc.git
synced 2025-10-31 02:36:46 +08:00
RTCP: test for unmarshaling nil packet
This commit is contained in:
committed by
Michiel De Backker
parent
74e2d1e3de
commit
894296d9ab
@@ -46,6 +46,7 @@ const (
|
||||
var (
|
||||
errInvalidVersion = errors.New("invalid version")
|
||||
errInvalidReportCount = errors.New("invalid report count")
|
||||
errHeaderTooShort = errors.New("rtcp header too short")
|
||||
)
|
||||
|
||||
// Marshal encodes the Header in binary
|
||||
@@ -83,7 +84,7 @@ func (h Header) Marshal() ([]byte, error) {
|
||||
// Unmarshal decodes the Header from binary
|
||||
func (h *Header) Unmarshal(rawPacket []byte) error {
|
||||
if len(rawPacket) < headerLength {
|
||||
return errors.Errorf("RTCP header size insufficient; %d < %d", len(rawPacket), headerLength)
|
||||
return errHeaderTooShort
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user