[libdvdnav-devel] [Git][videolan/libdvdread][master] dvd_udf: fix failure for discs storing file system descriptor at the end

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Fri Aug 7 16:08:46 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread


Commits:
50009a0e by Mario Holbe at 2026-08-07T18:48:16+03:00
dvd_udf: fix failure for discs storing file system descriptor at the end

libdvdread is very likely to fail on discs/images that store their File
System Descriptor at the end of the disc/image rather than at the
beginning. This is due to the "strategy" libdvdread uses to find it:
libdvdread scans sequentially from the beginning of the disc/image for
the File System Descriptor and identifies it by a single byte tag.

Aside from wasting lots of time on discs/images that store their File
System Descriptor at the end there is quite a good chance to stumble
across a random data block that accidentally starts with this tag (and
failing on it) before finding the real File System Descriptor.

As far as I can see, at least CDBurnerXP seems to (be able to) create
such images - at least if my interpretation of the Implementation
Identifier "NMS DVDProLib" is correct.

This fixes it by obtaining the File System Descriptor location from the
Logical Volume Descriptor.

[saifelden: read it with UDFLongAD() instead of a new parser, and clear the location when unset]

Co-authored-by: Saifelden Mohamed Ismail <saifeldenmi at gmail.com>

- - - - -


1 changed file:

- src/dvd_udf.c


Changes:

=====================================
src/dvd_udf.c
=====================================
@@ -76,6 +76,8 @@ struct Partition {
   uint32_t AccessType;
   uint32_t Start;
   uint32_t Length;
+  uint32_t FSD_Location;
+  uint32_t FSD_Length;
 };
 
 struct AD {
@@ -770,6 +772,8 @@ static int UDFFindPartition( dvd_reader_t *ctx, int partnum,
   MVDS_length = avdp.mvds.length;
 
   part->valid = 0;
+  part->FSD_Location = 0;
+  part->FSD_Length = 0;
   volvalid = 0;
   i = 1;
   do {
@@ -797,8 +801,16 @@ static int UDFFindPartition( dvd_reader_t *ctx, int partnum,
         /* Logical Volume Descriptor */
         if( UDFLogVolume( LogBlock ) ) {
           /* TODO: sector size wrong! */
-        } else
-          volvalid = 1;
+        } else {
+          struct AD fsd;
+
+          UDFLongAD( &LogBlock[ 248 ], &fsd );
+          if( part->Number == fsd.Partition ) {
+            part->FSD_Location = fsd.Location;
+            part->FSD_Length = fsd.Length;
+            volvalid = 1;
+          }
+        }
       }
 
     } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
@@ -841,7 +853,7 @@ uint32_t UDFFindFile( dvd_reader_t *ctx, const char *filename,
     SetUDFCache(ctx, PartitionCache, 0, &partition);
 
     /* Find root dir ICB */
-    lbnum = partition.Start;
+    lbnum = partition.Start + partition.FSD_Location;
     do {
       ret = DVDReadLBUDF( ctx, lbnum++, 1, LogBlock, 0 );
       if( ret < 0 ) {



View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/commit/50009a0e36bb3c0d55fcbeb4837999ab8f4e657b

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/commit/50009a0e36bb3c0d55fcbeb4837999ab8f4e657b
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the libdvdnav-devel mailing list