mirror of
https://github.com/aler9/gortsplib
synced 2025-10-28 17:31:53 +08:00
prevent decoding formats with zero clock rate or channels (#770)
This commit is contained in:
@@ -27,14 +27,14 @@ func (f *Vorbis) unmarshal(ctx *unmarshalContext) error {
|
||||
}
|
||||
|
||||
sampleRate, err := strconv.ParseUint(tmp[0], 10, 31)
|
||||
if err != nil {
|
||||
return err
|
||||
if err != nil || sampleRate == 0 {
|
||||
return fmt.Errorf("invalid sample rate: '%s'", tmp[0])
|
||||
}
|
||||
f.SampleRate = int(sampleRate)
|
||||
|
||||
channelCount, err := strconv.ParseUint(tmp[1], 10, 31)
|
||||
if err != nil {
|
||||
return err
|
||||
if err != nil || channelCount == 0 {
|
||||
return fmt.Errorf("invalid channel count: '%s'", tmp[1])
|
||||
}
|
||||
f.ChannelCount = int(channelCount)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user