Skip to content

Commit

Permalink
flac: fix decoding of 24 bps mono FLAC files
Browse files Browse the repository at this point in the history
Prior to this fix, such a file would cause an out-of-bounds panic.
  • Loading branch information
mewmew committed Aug 7, 2018
1 parent f88920f commit 05a918c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flac/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (d *decoder) refill() error {
case bps == 24 && nchannels == 1:
for i := 0; i < n; i++ {
d.buf[i][0] = float64(int32(frame.Subframes[0].Samples[i])) / (1<<23 - 1)
d.buf[i][1] = float64(int32(frame.Subframes[1].Samples[i])) / (1<<23 - 1)
d.buf[i][1] = float64(int32(frame.Subframes[0].Samples[i])) / (1<<23 - 1)
}
case bps == 8 && nchannels >= 2:
for i := 0; i < n; i++ {
Expand Down

0 comments on commit 05a918c

Please sign in to comment.