read_wim_lookup_table(): Ignore metadata entries with refcnt == 0
authorEric Biggers <ebiggers3@gmail.com>
Fri, 13 Sep 2013 15:07:44 +0000 (10:07 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 13 Sep 2013 15:14:33 +0000 (10:14 -0500)
If the WIM lookup table lists metadata resources with no references, ignore
them.  This unexpected case appears in WIMs appearing in WAIK v2.1.

NEWS
src/lookup_table.c

diff --git a/NEWS b/NEWS
index e11c1f2..c598fe9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
 Only the most important changes more recent than version 0.6 are noted here.
 
+Version 1.5.1:
+       wimlib can now open WinPE WIMs from WAIK v2.1, which had a quirk that
+       needed to be handled.
+
 Version 1.5.0:
        Added support for "pipable" WIMs.  Pipable WIMs allow capturing images
        to standard output and applying images from standard input, but they are
index 125887d..37d701a 100644 (file)
@@ -574,6 +574,13 @@ read_wim_lookup_table(WIMStruct *wim)
                if (cur_entry->resource_entry.flags & WIM_RESHDR_FLAG_METADATA) {
                        /* Lookup table entry for a metadata resource */
                        if (cur_entry->refcnt != 1) {
+                               /* Metadata entries with no references must be
+                                * ignored.  See for example the WinPE WIMs from
+                                * WAIK v2.1.  */
+                               if (cur_entry->refcnt == 0) {
+                                       free_lookup_table_entry(cur_entry);
+                                       continue;
+                               }
                                if (wimlib_print_errors) {
                                        ERROR("Found metadata resource with refcnt != 1:");
                                        print_lookup_table_entry(cur_entry, stderr);