diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-19 00:13:30 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-19 00:15:23 +0400 |
commit | 9bcc430481d7d1039be03802b91b2a52fef84e5b (patch) | |
tree | 9ef4c4c8dcfe776e11c8f21ae766818a027279a0 /libavresample/utils.c | |
parent | 733db64ce0c66214d7461fe0fdac097cd3c38a16 (diff) | |
parent | 088eca28164c8cd3b72b0c3d3f9e3fe5ee5cb28f (diff) |
Merge commit '088eca28164c8cd3b72b0c3d3f9e3fe5ee5cb28f'
* commit '088eca28164c8cd3b72b0c3d3f9e3fe5ee5cb28f':
avresample: prevent theoretical division by zero
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavresample/utils.c')
-rw-r--r-- | libavresample/utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavresample/utils.c b/libavresample/utils.c index 69c255b450..e285445d2f 100644 --- a/libavresample/utils.c +++ b/libavresample/utils.c @@ -585,9 +585,12 @@ static inline int convert_frame(AVAudioResampleContext *avr, static inline int available_samples(AVFrame *out) { + int samples; int bytes_per_sample = av_get_bytes_per_sample(out->format); - int samples = out->linesize[0] / bytes_per_sample; + if (!bytes_per_sample) + return AVERROR(EINVAL); + samples = out->linesize[0] / bytes_per_sample; if (av_sample_fmt_is_planar(out->format)) { return samples; } else { |