prevent decoding SDPs without media streams (#769)

This commit is contained in:
Alessandro Ros
2025-05-01 16:54:55 +02:00
committed by GitHub
parent 2e92a2a1f4
commit 162a72dd96
4 changed files with 28 additions and 6 deletions

View File

@@ -768,12 +768,21 @@ func FuzzSessionUnmarshal(f *testing.F) {
"a=rtpmap:101 ulpfec/8000\r\n" +
"a=mid:4\r\n")
f.Fuzz(func(_ *testing.T, enc string) {
f.Fuzz(func(t *testing.T, enc string) {
var sd sdp.SessionDescription
err := sd.Unmarshal([]byte(enc))
if err == nil {
var desc Session
desc.Unmarshal(&sd) //nolint:errcheck
if err != nil {
return
}
var desc Session
err = desc.Unmarshal(&sd)
if err != nil {
return
}
require.NotZero(t, len(desc.Medias))
desc.Marshal(false) //nolint:errcheck
})
}