[vlc-devel] commit: Detect division by zero before it happens ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Mar 3 18:59:52 CET 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Mon Mar  3 19:51:52 2008 +0200| [17291ac5f14e95b0698281ba72c0373b887aee4e]

Detect division by zero before it happens

Pointed-out-by: Drew Yao
Signed-off-by: Rémi Denis-Courmont <rem at videolan.org>

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

 modules/demux/real.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/modules/demux/real.c b/modules/demux/real.c
index f0f66ae..a3cc2af 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -1127,6 +1127,8 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
             i_subpacket_h = GetWBE( p_peek ); p_peek += 2;              /* 1 */
             i_frame_size = GetWBE( p_peek ); p_peek += 2;      /* frame size */
             i_subpacket_size = GetWBE( p_peek ); p_peek += 2;  /* subpacket_size */
+            if( !i_subpacket_size || !i_frame_size || !i_coded_frame_size )
+                 return VLC_EGENERIC;
             p_peek += 2;                                               /* ?? */
 
             if( i_version == 5 ) p_peek += 6;                 /* 0, srate, 0 */




More information about the vlc-devel mailing list