[vlc-commits] commit: Fixed segfault with corrupted zip file. (Laurent Aimar )
git at videolan.org
git at videolan.org
Thu Apr 15 18:54:42 CEST 2010
vlc/vlc-1.0 | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Feb 27 22:11:37 2010 +0100| [227c137bb8a72c9857a3e2a712ce51ae6bd7467b] | committer: Rémi Denis-Courmont
Fixed segfault with corrupted zip file.
(cherry picked from commit fe82dccc31a3a311f54cf8078127ba132679e54d)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.0.git/?a=commit;h=227c137bb8a72c9857a3e2a712ce51ae6bd7467b
---
modules/access/zip/zipstream.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/modules/access/zip/zipstream.c b/modules/access/zip/zipstream.c
index f4b9ed3..923e6c3 100644
--- a/modules/access/zip/zipstream.c
+++ b/modules/access/zip/zipstream.c
@@ -353,24 +353,22 @@ static int CreatePlaylist( stream_t *s, char **pp_buffer )
{
stream_sys_t *p_sys = s->p_sys;
+ unzFile file = p_sys->zipFile;
+ if( !file )
+ return -1;
+
/* Get some infos about zip archive */
int i_ret = 0;
- unzFile file = p_sys->zipFile;
vlc_array_t *p_filenames = vlc_array_new(); /* Will contain char* */
/* List all file names in Zip archive */
i_ret = GetFilesInZip( s, file, p_filenames, NULL );
if( i_ret < 0 )
{
- unzClose( file );
i_ret = -1;
goto exit;
}
- /* Close archive */
- unzClose( file );
- p_sys->zipFile = NULL;
-
/* Construct the xspf playlist */
i_ret = WriteXSPF( pp_buffer, p_filenames, p_sys->psz_path );
if( i_ret > 0 )
@@ -379,6 +377,10 @@ static int CreatePlaylist( stream_t *s, char **pp_buffer )
i_ret = -1;
exit:
+ /* Close archive */
+ unzClose( file );
+ p_sys->zipFile = NULL;
+
for( int i = 0; i < vlc_array_count( p_filenames ); i++ )
{
free( vlc_array_item_at_index( p_filenames, i ) );
More information about the vlc-commits
mailing list