Commit c671e1c9 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

flac: Error out if decoding RAW with bits != (8|16|24)

Suggested by Christopher Key.

Closes: https://sourceforge.net/p/flac/patches/43/
parent efaab3c8
......@@ -1344,6 +1344,12 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet
decoder_session->total_samples -= (metadata->data.stream_info.total_samples - until);
}
if(decoder_session->format == FORMAT_RAW && ((decoder_session->bps % 8) != 0 || decoder_session->bps < 4 || decoder_session->bps > 24)) {
flac__utils_printf(stderr, 1, "%s: ERROR: bits per sample is %u, must be 8/16/24 for raw format output\n", decoder_session->inbasefilename, decoder_session->bps);
decoder_session->abort_flag = true;
return;
}
if(decoder_session->bps < 4 || decoder_session->bps > 24) {
flac__utils_printf(stderr, 1, "%s: ERROR: bits per sample is %u, must be 4-24\n", decoder_session->inbasefilename, decoder_session->bps);
decoder_session->abort_flag = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment