]> wimlib.net Git - wimlib/blobdiff - src/lookup_table.c
imagex.c: Fix string literal used in oom path only
[wimlib] / src / lookup_table.c
index 125887dbbc9a9a60abb122ac7fee62245c4f25bd..4ad48bebb1ea207b5e077db079c1fa6c16d6228d 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);
@@ -1214,6 +1221,9 @@ inode_unnamed_lte(const struct wim_inode *inode,
                return inode_unnamed_lte_unresolved(inode, table);
 }
 
+/* Returns the SHA1 message digest of the unnamed data stream of a WIM inode, or
+ * 'zero_hash' if the unnamed data stream is missing has all zeroes in its SHA1
+ * message digest field.  */
 const u8 *
 inode_unnamed_stream_hash(const struct wim_inode *inode)
 {
@@ -1226,7 +1236,7 @@ inode_unnamed_stream_hash(const struct wim_inode *inode)
                                return hash;
                }
        }
-       return NULL;
+       return zero_hash;
 }