Browse Source

Do not try to decode more data than output buffer may hold

Originally committed as revision 10560 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Kostya Shishkov 18 years ago
parent
commit
4783cf0d09
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavcodec/adx.c

+ 5
- 0
libavcodec/adx.c View File

@@ -328,6 +328,11 @@ static int adx_decode_frame(AVCodecContext *avctx,
rest -= hdrsize;
}

/* 18 bytes of data are expanded into 32*2 bytes of audio,
so guard against buffer overflows */
if(rest/18 > *data_size/64)
rest = (*data_size/64) * 18;

if (c->in_temp) {
int copysize = 18*avctx->channels - c->in_temp;
memcpy(c->dec_temp+c->in_temp,buf,copysize);


Loading…
Cancel
Save