Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/flac/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,15 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet
}
decoder_session->replaygain.apply = false;
}
/* Bounds just to make sure calculations don't overflow */
else if(gain > 90 || gain < -90) {
flac__utils_printf(stderr, 1, "%s: WARNING: can't apply ReplayGain, found gain value doesn't make sense\n", decoder_session->inbasefilename);
if(decoder_session->treat_warnings_as_errors) {
decoder_session->abort_flag = true;
return;
}
decoder_session->replaygain.apply = false;
}
else {
const char *ls[] = { "no", "peak", "hard" };
const char *ns[] = { "no", "low", "medium", "high" };
Expand Down
6 changes: 4 additions & 2 deletions src/flac/foreign_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char **
{
FLAC__byte buffer[12];
FLAC__off_t offset, eof_offset = -1, ds64_data_size = -1;
FLAC__uint64 overflow_check;
if((offset = ftello(f)) < 0) {
if(error) *error = "ftello() error (001)";
return false;
Expand Down Expand Up @@ -314,12 +315,13 @@ static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char **
if(error) *error = "RF64 file has \"ds64\" chunk with extra size table, which is not currently supported (r06)";
return false;
}
eof_offset = (FLAC__off_t)8 + (FLAC__off_t)unpack64le_(buffer2);
overflow_check = 8 + unpack64le_(buffer2);
/* @@@ [2^63 limit] */
if((FLAC__off_t)unpack64le_(buffer2) < 0 || eof_offset < 0) {
if(overflow_check > FLAC__OFF_T_MAX) {
if(error) *error = "RF64 file too large (r07)";
return false;
}
eof_offset = (FLAC__off_t)overflow_check;
}
else { /* skip to next chunk */
if(fm->is_rf64 && !memcmp(buffer, "data", 4) && unpack32le_(buffer+4) == 0xffffffff) {
Expand Down
Loading