]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix Issue 100: Allow a zero for the Type M Path Table Location, since
authorTim Kientzle <kientzle@gmail.com>
Tue, 29 Jun 2010 19:45:25 +0000 (15:45 -0400)
committerTim Kientzle <kientzle@gmail.com>
Tue, 29 Jun 2010 19:45:25 +0000 (15:45 -0400)
WinISO (and probably other programs) set it this way.

SVN-Revision: 2516

libarchive/archive_read_support_format_iso9660.c

index 8b0ef74e05d8b4fb8d2f37c724556d1e6ff33d8c..48420830c617a444a03ccc9a211342ca54edeba7 100644 (file)
@@ -717,11 +717,13 @@ isSVD(struct iso9660 *iso9660, const unsigned char *h)
        if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
                return (0);
 
-       /* Location of Occurrence of Type M Path Table must be
-        * available location,
+       /* The Type M Path Table must be at a valid location (WinISO
+        * and probably other programs omit this, so we allow zero)
+        *
         * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
        location = archive_be32dec(h+SVD_type_M_path_table_offset);
-       if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+       if ((location > 0 && location <= SYSTEM_AREA_BLOCK+2)
+           || location >= volume_block)
                return (0);
 
        /* Read Root Directory Record in Volume Descriptor. */
@@ -793,7 +795,8 @@ isEVD(struct iso9660 *iso9660, const unsigned char *h)
         * available location,
         * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
        location = archive_be32dec(h+PVD_type_m_path_table_offset);
-       if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+       if ((location > 0 && location <= SYSTEM_AREA_BLOCK+2)
+           || location >= volume_block)
                return (0);
 
        /* Reserved field must be 0. */
@@ -868,11 +871,14 @@ isPVD(struct iso9660 *iso9660, const unsigned char *h)
        if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
                return (0);
 
-       /* Location of Occurrence of Type M Path Table must be
-        * available location,
+       /* The Type M Path Table must also be at a valid location
+        * (although ECMA 119 requires a Type M Path Table, WinISO and
+        * probably other programs omit it, so we permit a zero here)
+        *
         * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
        location = archive_be32dec(h+PVD_type_m_path_table_offset);
-       if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+       if ((location > 0 && location <= SYSTEM_AREA_BLOCK+2)
+           || location >= volume_block)
                return (0);
 
        /* Reserved field must be 0. */