Skip to content

Commit

Permalink
Upgrade an assert to an error
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmf01 committed Jan 27, 2025
1 parent 25ffd19 commit 3542ae8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/flac/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,11 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet

FLAC__ASSERT(decoder_session->skip_specification->value.samples >= 0);
FLAC__ASSERT(decoder_session->until_specification->value.samples >= 0);
FLAC__ASSERT((FLAC__uint64)decoder_session->until_specification->value.samples <= decoder_session->total_samples);
if((FLAC__uint64)decoder_session->until_specification->value.samples > decoder_session->total_samples) {
flac__utils_printf(stderr, 1, "%s: ERROR specified cuepoints exceed length of file\n", decoder_session->inbasefilename);
decoder_session->abort_flag = true;
return;
}
FLAC__ASSERT(decoder_session->skip_specification->value.samples <= decoder_session->until_specification->value.samples);

decoder_session->total_samples = decoder_session->until_specification->value.samples - decoder_session->skip_specification->value.samples;
Expand Down

0 comments on commit 3542ae8

Please sign in to comment.