changeset 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 ec04964a1d1a
children c08c9340c7ca
files adx.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/adx.c	Sun Sep 23 21:59:09 2007 +0000
+++ b/adx.c	Mon Sep 24 03:32:24 2007 +0000
@@ -328,6 +328,11 @@
         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);