]> wimlib.net Git - wimlib/blobdiff - src/integrity.c
Various cleanups
[wimlib] / src / integrity.c
index 70ff7ffe991a92f0c561e14d78b466ac1269fcc2..f94b7436b331f840e12382a5d879f859eb62f355 100644 (file)
@@ -201,6 +201,12 @@ int check_wim_integrity(WIMStruct *w, int show_progress, int *status)
        end_lookup_table_offset = w->hdr.lookup_table_res_entry.offset +
                                  w->hdr.lookup_table_res_entry.size;
 
+       if (end_lookup_table_offset < WIM_HEADER_DISK_SIZE) {
+               ERROR("WIM lookup table ends before WIM header ends???");
+               ret = WIMLIB_ERR_INVALID_INTEGRITY_TABLE;
+               goto out;
+       }
+
        bytes_to_check = end_lookup_table_offset - WIM_HEADER_DISK_SIZE;
 
        expected_num_entries = (bytes_to_check + chunk_size - 1) / chunk_size;