aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-21 20:46:29 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-22 01:19:01 +0200
commit533dbaa55b7d45d5ca76f9ed46f5690282f86ea9 (patch)
treec36b8efca3606b7ed74558c8b4d455e94cf03085 /libavcodec
parentec7f0b527c2f620003e041c7c41a3c9f82cf1536 (diff)
downloadffmpeg-533dbaa55b7d45d5ca76f9ed46f5690282f86ea9.tar.gz
Check output buffer size in nellymoser decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 741ec30bd2385f794efa9fafa84d39a917f2574e)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/nellymoserdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index 59c1b3bdd8..d85483dbf4 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -156,6 +156,7 @@ static int decode_tag(AVCodecContext * avctx,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
NellyMoserDecodeContext *s = avctx->priv_data;
+ int data_max = *data_size;
int blocks, i;
int16_t* samples;
*data_size = 0;
@@ -178,6 +179,8 @@ static int decode_tag(AVCodecContext * avctx,
*/
for (i=0 ; i<blocks ; i++) {
+ if ((i + 1) * NELLY_SAMPLES * sizeof(int16_t) > data_max)
+ return i > 0 ? i * NELLY_BLOCK_LEN : -1;
nelly_decode_block(s, &buf[i*NELLY_BLOCK_LEN], s->float_buf);
s->fmt_conv.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES);
*data_size += NELLY_SAMPLES*sizeof(int16_t);