[FFmpeg-cvslog] r10560 - trunk/libavcodec/adx.c

kostya subversion
Mon Sep 24 05:32:24 CEST 2007


Author: kostya
Date: Mon Sep 24 05:32:24 2007
New Revision: 10560

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

Modified:
   trunk/libavcodec/adx.c

Modified: trunk/libavcodec/adx.c
==============================================================================
--- trunk/libavcodec/adx.c	(original)
+++ trunk/libavcodec/adx.c	Mon Sep 24 05:32:24 2007
@@ -328,6 +328,11 @@ static int adx_decode_frame(AVCodecConte
         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);




More information about the ffmpeg-cvslog mailing list