mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-28 05:50:43 +00:00
rawdec: add check on sample_rate
Prevent error condition in case sample_rate is unset or set to a negative value. In particular, fix divide-by-zero error occurring in ffmpeg due to sample_rate set to 0 in output_packet(), in code: ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / ist->st->codec->sample_rate; Fix trac ticket #324.
This commit is contained in:
parent
8dc90371b1
commit
aa638b4600
@ -56,6 +56,12 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||
|
||||
if (s1 && s1->sample_rate)
|
||||
st->codec->sample_rate = s1->sample_rate;
|
||||
if (st->codec->sample_rate <= 0) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid sample rate %d specified\n",
|
||||
st->codec->sample_rate);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (s1 && s1->channels)
|
||||
st->codec->channels = s1->channels;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user