]> git.sesse.net Git - vlc/commitdiff
* demux: fix segfault while trying to opening files without extention...
authorLaurent Aimar <fenrir@videolan.org>
Thu, 23 Jan 2003 09:00:36 +0000 (09:00 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 23 Jan 2003 09:00:36 +0000 (09:00 +0000)
modules/demux/m3u.c
modules/demux/rawdv.c
modules/demux/util/sub.c

index f4eed26ad5d72e765e51bb8808f87e80208935c9..8e2e70e304e3e775532c4753d019a30747dabaed 100644 (file)
@@ -2,7 +2,7 @@
  * m3u.c: a meta demux to parse m3u and asx playlists
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: m3u.c,v 1.11 2003/01/16 21:14:23 babal Exp $
+ * $Id: m3u.c,v 1.12 2003/01/23 09:00:36 fenrir Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -90,20 +90,23 @@ static int Activate( vlc_object_t * p_this )
 
     /* Check for m3u/asx file extension */
     psz_ext = strrchr ( p_input->psz_name, '.' );
-    if( !strcasecmp( psz_ext, ".m3u") ||
-        ( p_input->psz_demux && !strncmp(p_input->psz_demux, "m3u", 3) ) )
+    if( psz_ext )
     {
-        i_type = TYPE_M3U;
-    }
-    else if( !strcasecmp( psz_ext, ".asx") ||
-             ( p_input->psz_demux && !strncmp(p_input->psz_demux, "asx", 3) ) )
-    {
-        i_type = TYPE_ASX;
-    }
-    else if( !strcasecmp( psz_ext, ".html") ||
-             ( p_input->psz_demux && !strncmp(p_input->psz_demux, "html", 4) ) )
-    {
-        i_type = TYPE_HTML;
+        if( !strcasecmp( psz_ext, ".m3u") ||
+            ( p_input->psz_demux && !strncmp(p_input->psz_demux, "m3u", 3) ) )
+        {
+            i_type = TYPE_M3U;
+        }
+        else if( !strcasecmp( psz_ext, ".asx") ||
+                 ( p_input->psz_demux && !strncmp(p_input->psz_demux, "asx", 3) ) )
+        {
+            i_type = TYPE_ASX;
+        }
+        else if( !strcasecmp( psz_ext, ".html") ||
+                 ( p_input->psz_demux && !strncmp(p_input->psz_demux, "html", 4) ) )
+        {
+            i_type = TYPE_HTML;
+        }
     }
 
     /* we had no luck looking at the file extention, so we have a look
index bc9becf07b3044aad414b02f7290ecb0351d9cd5..e17764e85977233f9094deb8a8ebedafd922bbeb 100644 (file)
@@ -2,7 +2,7 @@
  * rawdv.c : raw dv input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: rawdv.c,v 1.2 2003/01/07 21:49:01 fenrir Exp $
+ * $Id: rawdv.c,v 1.3 2003/01/23 09:00:36 fenrir Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -137,7 +137,7 @@ static int Activate( vlc_object_t * p_this )
 
     /* Check for dv file extension */
     psz_ext = strrchr ( p_input->psz_name, '.' );
-    if( strcasecmp( psz_ext, ".dv") &&
+    if( ( !psz_ext || strcasecmp( psz_ext, ".dv") )&&
         ( !p_input->psz_demux || strcmp(p_input->psz_demux, "rawdv") ) )
     {
         return -1;
index ac1fccb56e85309f2b516f3f2e4a9aef40be0ed5..394bd5cabf30845d57bfaccf79fa1930ed35be82 100644 (file)
@@ -2,7 +2,7 @@
  * sub.c
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: sub.c,v 1.2 2003/01/21 16:46:17 fenrir Exp $
+ * $Id: sub.c,v 1.3 2003/01/23 09:00:36 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -143,7 +143,7 @@ static int  sub_open ( subtitle_demux_t *p_sub,
     }
 
     /* *** Open the file *** */
-    if( !( p_file = fopen( psz_name, "r" ) ) )
+    if( !( p_file = fopen( psz_name, "rb" ) ) )
     {
         msg_Err( p_sub, "cannot open `%s' subtitle file", psz_name );