flac.Decode: makeslice: len out of range
- Dominant language
- Go
- Stars
- 95
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
When given a corrupt FLAC flac.Decode often panics as so:
```
panic: runtime error: makeslice: len out of range
goroutine 1 [running]:
github.com/eaburns/flac.riceDecode(0xc00009a360, 0xfffffffffffffffa, 0x8, 0x0, 0x0, 0x9, 0x1, 0xc0000a6100)
/home/ben/pkg/mod/github.com/eaburns/flac@v0.0.0-20171003200620-9a6fb92396d1/decode.go:835 +0x45
github.com/eaburns/flac.decodeResiduals(0xc00009a360, 0x1000, 0x8, 0xc0000a6100, 0x8, 0x8, 0x0, 0x0)
/home/ben/pkg/mod/github.com/eaburns/flac@v0.0.0-20171003200620-9a6fb92396d1/decode.go:818 +0x1e5
github.com/eaburns/flac.decodeLPCSubFrame(0xc00009a360, 0x18, 0x1000, 0x8, 0x0, 0x4, 0x4, 0x3, 0xc0000a2da8)
/home/ben/pkg/mod/github.com/eaburns/flac@v0.0.0-20171003200620-9a6fb92396d1/decode.go:747 +0x1c5
github.com/eaburns/flac.readSubFrame(0xc00009a360, 0xc0000c4100, 0x0, 0xc00009a390, 0x0, 0x0, 0x10100000040ceb8, 0x0)
/home/ben/pkg/mod/github.com/eaburns/flac@v0.0.0-20171003200620-9a6fb92396d1/decode.go:346 +0x38f
github.com/eaburns/flac.(*Decoder).Next(0xc00009a180, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/ben/pkg/mod/github.com/eaburns/flac@v0.0.0-20171003200620-9a6fb92396d1/decode.go:289 +0x245
github.com/eaburns/flac.Decode(0x4d1820, 0xc0000ae018, 0x0, 0xc000000000, 0xc0000ae018, 0x0, 0x0, 0x499d80, 0xc000094058)
/home/ben/pkg/mod/github.com/eaburns/flac@v0.0.0-20171003200620-9a6fb92396d1/decode.go:29 +0x145
```
Attached are two invalid FLACs which cause this panic, and one valid (surf.44101hz.flac.zip).
[qlevel--16-not-supported.flac.zip](https://github.com/eaburns/flac/files/5418452/qlevel--16-not-supported.flac.zip)
[crc-mismatch.flac.zip](https://github.com/eaburns/flac/files/5418459/crc-mismatch.flac.zip)
[surf.44101hz.flac.zip](https://github.com/eaburns/flac/files/5418463/surf.44101hz.flac.zip)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.