Mercurial > libavcodec.hg
diff truespeech.c @ 5674:ca944f1db2b3 libavcodec
Add checks on input/output buffers size for some audio decoders
author | kostya |
---|---|
date | Thu, 13 Sep 2007 05:59:58 +0000 |
parents | a96d905dcbaa |
children | 5b44e0210dad |
line wrap: on
line diff
--- a/truespeech.c Thu Sep 13 03:22:47 2007 +0000 +++ b/truespeech.c Thu Sep 13 05:59:58 2007 +0000 @@ -333,15 +333,17 @@ { TSContext *c = avctx->priv_data; - int i; + int i, j; short *samples = data; int consumed = 0; int16_t out_buf[240]; + int iterations; if (!buf_size) return 0; - while (consumed < buf_size) { + iterations = FFMIN(buf_size / 32, *data_size / 480); + for(j = 0; j < iterations; j++) { truespeech_read_frame(c, buf + consumed); consumed += 32; @@ -366,7 +368,7 @@ *data_size = consumed * 15; - return buf_size; + return consumed; } AVCodec truespeech_decoder = {