Skip to content
Snippets Groups Projects
Commit 4783cf0d authored by Kostya Shishkov's avatar Kostya Shishkov
Browse files

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

Originally committed as revision 10560 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8b505fc6
No related branches found
No related tags found
No related merge requests found
...@@ -328,6 +328,11 @@ static int adx_decode_frame(AVCodecContext *avctx, ...@@ -328,6 +328,11 @@ static int adx_decode_frame(AVCodecContext *avctx,
rest -= hdrsize; 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) { if (c->in_temp) {
int copysize = 18*avctx->channels - c->in_temp; int copysize = 18*avctx->channels - c->in_temp;
memcpy(c->dec_temp+c->in_temp,buf,copysize); memcpy(c->dec_temp+c->in_temp,buf,copysize);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment