aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/truespeech.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2007-09-13 05:59:58 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2007-09-13 05:59:58 +0000
commite938637b2ca7587c2b349458189f1f7d7da87040 (patch)
tree0b8a5976d52bf7ead0293af75a4aaf5c2f6e21fd /libavcodec/truespeech.c
parentbf4a1f17ee9237b6efd4250cf894e274afc31a5f (diff)
downloadffmpeg-e938637b2ca7587c2b349458189f1f7d7da87040.tar.gz
Add checks on input/output buffers size for some audio decoders
Originally committed as revision 10485 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/truespeech.c')
-rw-r--r--libavcodec/truespeech.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c
index a03f2a0ced..eafbdf7a01 100644
--- a/libavcodec/truespeech.c
+++ b/libavcodec/truespeech.c
@@ -333,15 +333,17 @@ static int truespeech_decode_frame(AVCodecContext *avctx,
{
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 @@ static int truespeech_decode_frame(AVCodecContext *avctx,
*data_size = consumed * 15;
- return buf_size;
+ return consumed;
}
AVCodec truespeech_decoder = {