Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2011-10-27 03:38:21 +0400
committerMichael Niedermayer <michaelni@gmx.at>2011-11-19 00:33:11 +0400
commit91805f06a39ca82e1463ebce578452d0e2f22bf6 (patch)
tree9461a091258a1139ddab696465e4f748c858beff
parent8120a1d9bd4bcc4434b4f588f50c9d81aa8ad0e0 (diff)
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. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rawdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index a4e009b7e0..02e335ad1b 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -59,6 +59,12 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (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->channels)
st->codec->channels = s1->channels;