[vlc-commits] dvdnav: check ISO 9660 volume descriptor unique identifier

Rémi Denis-Courmont git at videolan.org
Sat Oct 27 19:17:20 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 27 20:06:47 2012 +0300| [ad3ea21d61c1acebba5d89aa2a2d96cab9edd0b1] | committer: Rémi Denis-Courmont

dvdnav: check ISO 9660 volume descriptor unique identifier

And drop the lame file extension checks. This should fix #7661.

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

 modules/access/dvdnav.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index e808f0e..33f811d 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -1465,14 +1465,11 @@ static int ProbeDVD( const char *psz_name )
         goto bailout;
     }
 
-    /* Match extension as the anchor exhibits too many false positives */
-    const char *ext = strrchr( psz_name, '.' );
-    if( ext == NULL )
-        goto bailout;
-    ext++;
-    if( strcasecmp( ext, "iso" ) && strcasecmp( ext, "img" ) &&
-        strcasecmp( ext, "mdf" ) && strcasecmp( ext, "dvd" ) &&
-        strcasecmp( ext, "bin" ) && strcasecmp( ext, "nrg" ) )
+    /* ISO 9660 volume descriptor */
+    char iso_dsc[6];
+    if( lseek( fd, 0x8000 + 1, SEEK_SET ) == -1
+     || read( fd, iso_dsc, sizeof (iso_dsc) ) < sizeof (iso_dsc)
+     || memcmp( iso_dsc, "CD001\x01", 6 ) )
         goto bailout;
 
     /* Try to find the anchor (2 bytes at LBA 256) */
@@ -1482,7 +1479,6 @@ static int ProbeDVD( const char *psz_name )
      && read( fd, &anchor, 2 ) == 2
      && GetWLE( &anchor ) == 2 )
         ret = VLC_SUCCESS; /* Found a potential anchor */
-
 bailout:
     close( fd );
     return ret;



More information about the vlc-commits mailing list