[vlc-devel] commit: demux(avi): fix crash occuring when trying to open some avi files ( Erwan Tulou )

git version control git at videolan.org
Tue Feb 16 14:02:10 CET 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Feb 16 13:07:10 2010 +0100| [97b484a832fa5846a69c538047c7761e749e939d] | committer: Erwan Tulou 

demux(avi): fix crash occuring when trying to open some avi files

fmt.p_extra should only reference malloc'ed memory, since it is cleaned
with free() in es_format_Clean.

This patch reuses the same logic for p_vids as that of p_auds.

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

 modules/demux/avi/avi.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index fc1d24e..5235376 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -569,7 +569,10 @@ static int Open( vlc_object_t * p_this )
                 fmt.i_extra =
                     __MIN( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
                            p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) );
-                fmt.p_extra = &p_vids->p_bih[1];
+                fmt.p_extra = malloc( fmt.i_extra );
+                if( !fmt.p_extra ) goto error;
+                memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
+
                 msg_Dbg( p_demux, "stream[%d] video(%4.4s) %"PRIu32"x%"PRIu32" %dbpp %ffps",
                          i, (char*)&p_vids->p_bih->biCompression,
                          (uint32_t)p_vids->p_bih->biWidth,




More information about the vlc-devel mailing list