diff --git a/src/flac/decode.c b/src/flac/decode.c index c5d8fd52..df0f7b3f 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -1144,6 +1144,10 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder else { /* must not have gotten STREAMINFO, save the bps from the frame header */ FLAC__ASSERT(!decoder_session->got_stream_info); + if(decoder_session->format == FORMAT_RAW && ((decoder_session->bps % 8) != 0 || decoder_session->bps < 4)) { + flac__utils_printf(stderr, 1, "%s: ERROR: bits per sample is %u, must be 8/16/24/32 for raw format output\n", decoder_session->inbasefilename, decoder_session->bps); + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } decoder_session->bps = bps; }