summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>2011-01-23 15:25:48 -0500
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>2011-01-23 15:25:48 -0500
commit884b602b8fb966cd749ca9e4406133007fb25eb4 (patch)
treed1e9f32be92c8a54409bc08c9f9e7b4bc8c9cfaf
parent17e0823893c28c17bbf290f424aff6d26c164205 (diff)
downloadlibarchive-884b602b8fb966cd749ca9e4406133007fb25eb4.tar.gz
If the offset of a file entry is zero, set -1 to the offset, which is
calculated from its location, to make sure the entry will appear after directory entries. Some ISO image writer(xorriso) set zero to the location of a symlink entry. It causes that our ISO-reader cannot read following directory entries at all since we expect directory entries is located before file entries and we are sorting all entry in an ISO image by the offset to read the contents of the entries in stream. SVN-Revision: 2940
-rw-r--r--libarchive/archive_read_support_format_iso9660.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c
index 3d22a057..105b57eb 100644
--- a/libarchive/archive_read_support_format_iso9660.c
+++ b/libarchive/archive_read_support_format_iso9660.c
@@ -1832,14 +1832,17 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
* NOTE: Old mkisofs did not record that FILE SERIAL NUMBER
* in ISO images.
*/
- if (file->size == 0 && location >= 0)
+ if (file->size == 0 && location >= 0) {
/* If file->size is zero, its location points wrong place.
* Dot not use it for file number.
* When location has negative value, it can be used
* for file number.
*/
file->number = -1;
- else
+ /* Do not appear before any directoy entries. */
+ if (file->offset == 0)
+ file->offset = -1;
+ } else
file->number = (int64_t)(uint32_t)location;
/* Rockridge extensions overwrite information from above. */