write.c: don't write integrity table if there is no blob table
authorEric Biggers <ebiggers3@gmail.com>
Sat, 24 Oct 2015 19:31:24 +0000 (14:31 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 7 Nov 2015 20:52:02 +0000 (14:52 -0600)
The following commands would produce an invalid integrity table:

wimcapture empty empty.wim
wimdelete delete empty.wim 1 --check

src/write.c

index bc7b6eb..9e39616 100644 (file)
@@ -2388,7 +2388,9 @@ finish_write(WIMStruct *wim, int image, int write_flags,
        }
 
        /* Write integrity table if needed.  */
-       if (write_flags & WIMLIB_WRITE_FLAG_CHECK_INTEGRITY) {
+       if ((write_flags & WIMLIB_WRITE_FLAG_CHECK_INTEGRITY) &&
+           wim->out_hdr.blob_table_reshdr.offset_in_wim != 0)
+       {
                if (write_flags & WIMLIB_WRITE_FLAG_NO_NEW_BLOBS) {
                        /* The XML data we wrote may have overwritten part of
                         * the old integrity table, so while calculating the new