mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-30 13:50:50 +08:00
Check output buffer size in nellymoser decoder.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit741ec30bd2) (cherry picked from commit533dbaa55b) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
committed by
Michael Niedermayer
parent
8ef917c033
commit
25bc1108c2
@@ -154,6 +154,7 @@ static int decode_tag(AVCodecContext * avctx,
|
||||
void *data, int *data_size,
|
||||
const uint8_t * buf, int buf_size) {
|
||||
NellyMoserDecodeContext *s = avctx->priv_data;
|
||||
int data_max = *data_size;
|
||||
int blocks, i;
|
||||
int16_t* samples;
|
||||
*data_size = 0;
|
||||
@@ -177,6 +178,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->dsp.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES);
|
||||
*data_size += NELLY_SAMPLES*sizeof(int16_t);
|
||||
|
||||
Reference in New Issue
Block a user