Skip to content

Commit 18a7702

Browse files
tanghaowillowstv0g
authored andcommittedAug 8, 2023
Add invalid repeat times unmarshal test
1 parent ac6517e commit 18a7702

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎fuzz_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "testing"
77

88
func FuzzUnmarshal(f *testing.F) {
99
f.Add([]byte{})
10-
f.Add([]byte(CanonicalMarshalSDP))
10+
f.Add([]byte(CanonicalUnmarshalSDP))
1111
f.Fuzz(func(t *testing.T, data []byte) {
1212
// Check that unmarshalling any byte slice does not panic.
1313
var sd SessionDescription

‎unmarshal_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ func TestUnmarshalRepeatTimes(t *testing.T) {
338338
if string(actual) != RepeatTimesSDPExpected {
339339
t.Errorf("error:\n\nEXPECTED:\n%v\nACTUAL:\n%v", RepeatTimesSDPExpected, string(actual))
340340
}
341+
342+
err = sd.Unmarshal([]byte(TimingSDP + "r=\r\n"))
343+
if got, want := err, errSDPInvalidValue; !errors.Is(got, want) {
344+
t.Fatalf("Marshal(): err=%v, want %v", got, want)
345+
}
341346
}
342347

343348
func TestUnmarshalTimeZones(t *testing.T) {

0 commit comments

Comments
 (0)
Please sign in to comment.