From e048a9cab10f1d41dca7b1ad9c8ecaceb3424d86 Mon Sep 17 00:00:00 2001 From: Daniel Kang Date: Tue, 11 Jan 2011 14:08:45 +0000 Subject: Do not crash for illegal sample size, fixes issue 2502. Patch by Daniel Kang, daniel.d.kang at gmail Originally committed as revision 26309 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/pcm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libavcodec/pcm.c') diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index b6b49dc049..533e834a54 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -292,6 +292,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, /* we process 40-bit blocks per channel for LXF */ sample_size = 5; + if (sample_size == 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n"); + return AVERROR(EINVAL); + } + n = avctx->channels * sample_size; if(n && buf_size % n){ -- cgit v1.2.3