Skip to content

Commit

Permalink
Mono FLAC files would crash, buffer retrieval expected (atleast) two …
Browse files Browse the repository at this point in the history
…channels to be present.
  • Loading branch information
mywave82 committed Mar 28, 2024
1 parent f596acd commit 374f027
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion playflac/flacplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,12 @@ static FLAC__StreamDecoderWriteStatus write_callback (
{
/* append to buffer */
flacbuf[pos1*2+0] = make_16bit(buffer[0][i], frame->header.bits_per_sample);
flacbuf[pos1*2+1] = make_16bit(buffer[1][i], frame->header.bits_per_sample);
if (frame->header.channels < 2)
{
flacbuf[pos1*2+1] = flacbuf[pos1*2];
} else {
flacbuf[pos1*2+1] = make_16bit(buffer[1][i], frame->header.bits_per_sample);
}
pos1++;
if (!--length1)
{
Expand Down

0 comments on commit 374f027

Please sign in to comment.