Commit 1cf18de9 authored by Tomas Härdin's avatar Tomas Härdin Committed by Anton Khirnov

wav: make sure neither data_size nor sample_count is negative.

Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 7f84055e
...@@ -318,6 +318,12 @@ static int wav_read_header(AVFormatContext *s, ...@@ -318,6 +318,12 @@ static int wav_read_header(AVFormatContext *s,
avio_rl64(pb); /* RIFF size */ avio_rl64(pb); /* RIFF size */
data_size = avio_rl64(pb); data_size = avio_rl64(pb);
sample_count = avio_rl64(pb); sample_count = avio_rl64(pb);
if (data_size < 0 || sample_count < 0) {
av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in "
"ds64: data_size = %"PRId64", sample_count = %"PRId64"\n",
data_size, sample_count);
return AVERROR_INVALIDDATA;
}
avio_skip(pb, size - 16); /* skip rest of ds64 chunk */ avio_skip(pb, size - 16); /* skip rest of ds64 chunk */
} }
......
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