[FFmpeg-cvslog] avresample: prevent theoretical division by zero
Vittorio Giovara
git at videolan.org
Sat Oct 18 22:20:53 CEST 2014
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Wed Oct 15 17:33:00 2014 +0100| [088eca28164c8cd3b72b0c3d3f9e3fe5ee5cb28f] | committer: Vittorio Giovara
avresample: prevent theoretical division by zero
CC: libav-stable at libav.org
Bug-Id: CID 1231986
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=088eca28164c8cd3b72b0c3d3f9e3fe5ee5cb28f
---
libavresample/utils.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavresample/utils.c b/libavresample/utils.c
index 5d095c0..8ba8a09 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 {
More information about the ffmpeg-cvslog
mailing list