RTCP: test for unmarshaling nil packet

This commit is contained in:
Max Hawkins
2018-09-10 22:05:38 -07:00
committed by Michiel De Backker
parent 74e2d1e3de
commit 894296d9ab
2 changed files with 10 additions and 1 deletions

View File

@@ -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
}
/*