From 30826771c6e9970635b393adc15048804d45677e Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 13 Jun 2014 23:46:58 -0500 Subject: [PATCH] finish_write(): Don't use old integrity table if already overwritten When updating a WIM in-place without modifying the lookup table, the new XML data will spill into the old integrity table if the new XML data is longer than the old XML data. Temporarily fix this by not using the old integrity table in this case. --- src/write.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/write.c b/src/write.c index 5bca038a..9acdffac 100644 --- a/src/write.c +++ b/src/write.c @@ -2350,6 +2350,15 @@ finish_write(WIMStruct *wim, int image, int write_flags, if (!(write_flags & WIMLIB_WRITE_FLAG_REUSE_INTEGRITY_TABLE)) old_lookup_table_end = 0; + if (wim->hdr.integrity_table_reshdr.offset_in_wim < + wim->hdr.xml_data_reshdr.offset_in_wim + + wim->hdr.xml_data_reshdr.size_in_wim) + { + /* Old integrity table was partially overwritten by the + * XML data. */ + old_lookup_table_end = 0; + } + new_lookup_table_end = wim->hdr.lookup_table_reshdr.offset_in_wim + wim->hdr.lookup_table_reshdr.size_in_wim; -- 2.43.0