summaryrefslogtreecommitdiff
path: root/libavcodec/pcm.c
diff options
context:
space:
mode:
authorDaniel Kang <daniel.d.kang@gmail.com>2011-01-11 14:08:45 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2011-01-11 14:08:45 +0000
commite048a9cab10f1d41dca7b1ad9c8ecaceb3424d86 (patch)
treeedfb2db5ca2ce9a187c621bcea1329205a4a6171 /libavcodec/pcm.c
parent440d761e40e05af4eed5fb8ceccbe50382c47465 (diff)
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
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r--libavcodec/pcm.c5
1 files changed, 5 insertions, 0 deletions
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){