[FFmpeg-devel] [PATCH] Check for buffer overflow in ADX decoder

Kostya kostya.shishkov
Sat Sep 22 07:37:04 CEST 2007


$subj
-------------- next part --------------
Index: libavcodec/adx.c
===================================================================
--- libavcodec/adx.c	(revision 10505)
+++ libavcodec/adx.c	(working copy)
@@ -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);



More information about the ffmpeg-devel mailing list