From: Michihiro NAKAJIMA Date: Mon, 2 Nov 2009 02:59:56 +0000 (-0500) Subject: To be robust when ISO image is broken. X-Git-Tag: v2.8.0~240 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ecb8c6b24725b7adcee59ad869c275c3a4fb622;p=thirdparty%2Flibarchive.git To be robust when ISO image is broken. SVN-Revision: 1575 --- diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c index 5d9925583..a913b38d9 100644 --- a/libarchive/archive_read_support_format_iso9660.c +++ b/libarchive/archive_read_support_format_iso9660.c @@ -1128,12 +1128,25 @@ read_entries(struct archive_read *a) /* If rr_moved directory still has children, * Add rr_moved into pending_files to show */ - if (iso9660->rr_moved->subdirs) + if (iso9660->rr_moved->subdirs) { cache_add_entry(iso9660, iso9660->rr_moved); - else { + /* If entries which have "RE" extension are still + * remaining(this case is unlikely except ISO image + * is broken), the entries won't be exposed. */ + while ((file = heap_get_entry(&(iso9660->re_dirs))) != NULL) + cache_add_entry(iso9660, file); + } else { iso9660->rr_moved->parent->subdirs--; release_file(iso9660, iso9660->rr_moved); } + } else { + /* + * In case ISO image is broken. If the name of rr_moved + * directory has been changed by damage, subdirectories + * of rr_moved entry won't be exposed. + */ + while ((file = heap_get_entry(&(iso9660->re_dirs))) != NULL) + cache_add_entry(iso9660, file); } return (ARCHIVE_OK); @@ -2663,6 +2676,8 @@ cache_get_entry(struct iso9660 *iso9660) if ((file = iso9660->cache_files.first) != NULL) { iso9660->cache_files.first = file->next; file->refcount--; + if (iso9660->cache_files.first == NULL) + iso9660->cache_files.last = &(iso9660->cache_files.first); } return (file); } diff --git a/tar/tree.c b/tar/tree.c index eeae00b03..828762ba1 100644 --- a/tar/tree.c +++ b/tar/tree.c @@ -715,9 +715,11 @@ int tree_current_is_physical_link(struct tree *t) { #if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(IO_REPARSE_TAG_SYMLINK) if (t->findData) return ((t->findData->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && (t->findData->dwReserved0 == IO_REPARSE_TAG_SYMLINK)); +#endif return (0); #else const struct stat *st = tree_current_lstat(t);