Skip to content

flac.Decode: makeslice: len out of range #11

@0xbzho

Description

@0xbzho

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
crc-mismatch.flac.zip
surf.44101hz.flac.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions