mirror of
https://github.com/aler9/gortsplib
synced 2025-10-31 02:26:57 +08:00
prevent decoding formats with zero clock rate or channels (#770)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package format
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -23,15 +24,15 @@ func (f *AC3) unmarshal(ctx *unmarshalContext) error {
|
||||
tmp := strings.SplitN(ctx.clock, "/", 2)
|
||||
|
||||
tmp1, err := strconv.ParseUint(tmp[0], 10, 31)
|
||||
if err != nil {
|
||||
return err
|
||||
if err != nil || tmp1 == 0 {
|
||||
return fmt.Errorf("invalid sample rate: '%s'", tmp[0])
|
||||
}
|
||||
f.SampleRate = int(tmp1)
|
||||
|
||||
if len(tmp) >= 2 {
|
||||
tmp1, err := strconv.ParseUint(tmp[1], 10, 31)
|
||||
if err != nil {
|
||||
return err
|
||||
if err != nil || tmp1 == 0 {
|
||||
return fmt.Errorf("invalid channel count: '%s'", tmp[1])
|
||||
}
|
||||
f.ChannelCount = int(tmp1)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user