[vlc-commits] codec: avcodec: assert provides no safety

Francois Cartegnie git at videolan.org
Sat May 16 15:26:41 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat May 16 15:24:55 2015 +0200| [c5d61dbf0f53fcc753f47eae7ccfe53767571b35] | committer: Francois Cartegnie

codec: avcodec: assert provides no safety

refs #14649

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c5d61dbf0f53fcc753f47eae7ccfe53767571b35
---

 modules/codec/avcodec/audio.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index da521e5..fd3a7c0 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -313,6 +313,9 @@ static block_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
         }
 
         assert( p_block->i_buffer >= (unsigned)used );
+        if( used > p_block->i_buffer )
+            used = p_block->i_buffer;
+
         p_block->p_buffer += used;
         p_block->i_buffer -= used;
     }



More information about the vlc-commits mailing list