From: Eric Biggers Date: Sat, 14 Jun 2014 04:46:58 +0000 (-0500) Subject: finish_write(): Don't use old integrity table if already overwritten X-Git-Tag: v1.7.0~11 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=30826771c6e9970635b393adc15048804d45677e 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. --- 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;