prevent decoding formats with zero clock rate or channels (#770)

This commit is contained in:
Alessandro Ros
2025-05-01 17:06:55 +02:00
committed by GitHub
parent 18307140ec
commit bfacd10d35
16 changed files with 76 additions and 30 deletions

View File

@@ -65,10 +65,9 @@ func (f *Opus) unmarshal(ctx *unmarshalContext) error {
}
channelCount, err := strconv.ParseUint(tmp[1], 10, 31)
if err != nil {
if err != nil || channelCount == 0 {
return fmt.Errorf("invalid channel count: '%s'", tmp[1])
}
f.ChannelCount = int(channelCount)
}