[vlc-commits] aout: assert only is not release proof
Francois Cartegnie
git at videolan.org
Sat Aug 30 05:30:40 CEST 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Aug 29 15:21:56 2014 +0900| [430f67dbb2760f50d0955d074adf8aca84b3e6d1] | committer: Francois Cartegnie
aout: assert only is not release proof
Can still div by zero by pushing vbr codec
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=430f67dbb2760f50d0955d074adf8aca84b3e6d1
---
src/audio_output/common.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index f92230e..ab8c9c6 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -292,6 +292,8 @@ void aout_ChannelReorder( void *ptr, size_t bytes, unsigned channels,
assert( channels != 0 );
assert( channels <= AOUT_CHAN_MAX );
+ if ( channels == 0 || channels >= AOUT_CHAN_MAX )
+ return;
/* The audio formats supported in audio output are inlined. For other
* formats (used in demuxers and muxers), memcpy() is used to avoid
* breaking type punning. */
@@ -323,6 +325,8 @@ do { \
{
unsigned size = aout_BitsPerSample( fourcc ) / 8;
assert( size != 0 );
+ if ( size == 0 )
+ return;
const size_t frames = bytes / (size * channels);
unsigned char *buf = ptr;
More information about the vlc-commits
mailing list