From b072e7cbca1ccb874e22aa94e3efae37ce211939 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 13 Sep 2013 10:07:44 -0500 Subject: [PATCH] read_wim_lookup_table(): Ignore metadata entries with refcnt == 0 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 | 4 ++++ src/lookup_table.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index e11c1f2c..c598fe98 100644 --- 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 diff --git a/src/lookup_table.c b/src/lookup_table.c index 125887db..37d701a1 100644 --- a/src/lookup_table.c +++ b/src/lookup_table.c @@ -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); -- 2.43.0