diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-10-15 17:33:00 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-10-18 16:15:10 +0100 |
commit | 088eca28164c8cd3b72b0c3d3f9e3fe5ee5cb28f (patch) | |
tree | d0bb52e0c1722b95bfcae6a01e8788ac1e3713ee | |
parent | 0d989dbfc4bc5bc1d563e967449116a7a9865258 (diff) | |
download | ffmpeg-088eca28164c8cd3b72b0c3d3f9e3fe5ee5cb28f.tar.gz |
avresample: prevent theoretical division by zero
CC: libav-stable@libav.org
Bug-Id: CID 1231986
-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 5d095c054b..8ba8a0975b 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 { |