mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
fix max sample rate checking
This commit is contained in:
@@ -216,7 +216,7 @@ int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, cons
|
||||
/* sample rate */
|
||||
if(!read_little_endian_uint32(infile, &xx, false, encoder_wrapper.inbasefilename))
|
||||
goto wav_abort_;
|
||||
if(xx == 0 || xx > FLAC__MAX_SAMPLE_RATE) {
|
||||
if(!FLAC__format_is_valid_sample_rate(xx)) {
|
||||
fprintf(stderr, "%s: ERROR: unsupported sample rate %u\n", encoder_wrapper.inbasefilename, (unsigned)xx);
|
||||
goto wav_abort_;
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ int main(int argc, char *argv[])
|
||||
return long_usage("ERROR: invalid bits per sample '%u' (must be 8/16/24)\n", format_bps);
|
||||
}
|
||||
if(format_sample_rate >= 0) {
|
||||
if(format_sample_rate == 0 || (unsigned)format_sample_rate > FLAC__MAX_SAMPLE_RATE)
|
||||
if(!FLAC__format_is_valid_sample_rate(format_sample_rate))
|
||||
return long_usage("ERROR: invalid sample rate '%u', must be > 0 and <= %u\n", format_sample_rate, FLAC__MAX_SAMPLE_RATE);
|
||||
}
|
||||
if(!mode_decode && ((unsigned)blocksize < FLAC__MIN_BLOCK_SIZE || (unsigned)blocksize > FLAC__MAX_BLOCK_SIZE)) {
|
||||
|
||||
Reference in New Issue
Block a user