comparison adx.c @ 5704:cf77b8588f15 libavcodec

Do not try to decode more data than output buffer may hold
author kostya
date Mon, 24 Sep 2007 03:32:24 +0000
parents bc4791868c52
children ad587a64ef52
comparison
equal deleted inserted replaced
5703:ec04964a1d1a 5704:cf77b8588f15
326 c->header_parsed = 1; 326 c->header_parsed = 1;
327 buf += hdrsize; 327 buf += hdrsize;
328 rest -= hdrsize; 328 rest -= hdrsize;
329 } 329 }
330 330
331 /* 18 bytes of data are expanded into 32*2 bytes of audio,
332 so guard against buffer overflows */
333 if(rest/18 > *data_size/64)
334 rest = (*data_size/64) * 18;
335
331 if (c->in_temp) { 336 if (c->in_temp) {
332 int copysize = 18*avctx->channels - c->in_temp; 337 int copysize = 18*avctx->channels - c->in_temp;
333 memcpy(c->dec_temp+c->in_temp,buf,copysize); 338 memcpy(c->dec_temp+c->in_temp,buf,copysize);
334 rest -= copysize; 339 rest -= copysize;
335 buf += copysize; 340 buf += copysize;