[vlc-commits] demux: asf: check malloc

Francois Cartegnie git at videolan.org
Mon Feb 13 18:13:32 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 13 18:12:35 2017 +0100| [05c4b03522f6f6128b90a97b2267b015f61ef57e] | committer: Francois Cartegnie

demux: asf: check malloc

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

 modules/demux/asf/asf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index 2c1b4ea..e0b8270 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -1108,8 +1108,10 @@ static int DemuxInit( demux_t *p_demux )
                                          sizeof( WAVEFORMATEX ) ),
                                  INT_MAX, uint32_t );
                     fmt.p_extra = malloc( fmt.i_extra );
-                    memcpy( fmt.p_extra, &p_data[sizeof( WAVEFORMATEX )],
-                        fmt.i_extra );
+                    if ( fmt.p_extra )
+                        memcpy( fmt.p_extra, &p_data[sizeof( WAVEFORMATEX )], fmt.i_extra );
+                    else
+                        fmt.i_extra = 0;
                 }
 
                 msg_Dbg( p_demux, "added new audio stream (codec:0x%x,ID:%d)",



More information about the vlc-commits mailing list