[vlc-devel] commit: Fixed segfault on corrupted wav file. (Laurent Aimar )

git version control git at videolan.org
Sun Jun 29 10:49:34 CEST 2008


vlc | branch: 0.8.6-bugfix | Laurent Aimar <fenrir at videolan.org> | Sat Jun 28 22:09:27 2008 +0000| [19c07a54ade859d82f1b99ce30746faf961c98f7]

Fixed segfault on corrupted wav file.
(cherry picked from commit a11cc33695f3b4bc9f939e457bd3e5f16397968f)

Signed-off-by: Rémi Denis-Courmont <rdenis at simphalempin.com>

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

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

diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index 44b2715..c8ee74b 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -169,7 +169,8 @@ static int Open( vlc_object_t * p_this )
     p_sys->fmt.audio.i_blockalign = GetWLE( &p_wf->nBlockAlign );
     p_sys->fmt.i_bitrate = GetDWLE( &p_wf->nAvgBytesPerSec ) * 8;
     p_sys->fmt.audio.i_bitspersample = GetWLE( &p_wf->wBitsPerSample );
-    p_sys->fmt.i_extra = GetWLE( &p_wf->cbSize );
+    if( i_size >= sizeof(WAVEFORMATEX) )
+        p_sys->fmt.i_extra = __MIN( GetWLE( &p_wf->cbSize ), i_size - sizeof(WAVEFORMATEX) );
     i_extended = 0;
 
     /* Handle new WAVE_FORMAT_EXTENSIBLE wav files */




More information about the vlc-devel mailing list