From ad3ea21d61c1acebba5d89aa2a2d96cab9edd0b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net> Date: Sat, 27 Oct 2012 20:06:47 +0300 Subject: [PATCH] dvdnav: check ISO 9660 volume descriptor unique identifier And drop the lame file extension checks. This should fix #7661. --- 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 e808f0e5bec3..33f811dc80fb 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; -- GitLab