]> git.sesse.net Git - vlc/commitdiff
aout: assert only is not release proof
authorFrancois Cartegnie <fcvlcdev@free.fr>
Fri, 29 Aug 2014 06:21:56 +0000 (15:21 +0900)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 30 Aug 2014 02:51:00 +0000 (11:51 +0900)
Can still div by zero by pushing vbr codec

src/audio_output/common.c

index f92230ec0d051c521e37b196021e03cfd973c0b3..ab8c9c6010c5d79fc8908fcabcbb87e93448367e 100644 (file)
@@ -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;