read_wim_lookup_table(): Make sure all resources get validated
authorEric Biggers <ebiggers3@gmail.com>
Tue, 29 Apr 2014 01:42:12 +0000 (20:42 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 29 Apr 2014 01:42:12 +0000 (20:42 -0500)
src/lookup_table.c

index 8c394f7..d42826d 100644 (file)
@@ -811,10 +811,10 @@ read_wim_lookup_table(WIMStruct *wim)
                 *   wimlib does not currently allow create WIMs with multiple
                 *   packed resources, as to remain compatible with WIMGAPI.)
                 */
-               if (likely(!cur_rspec) ||
-                   !(reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS) ||
-                     (reshdr.uncompressed_size == WIM_PACK_MAGIC_NUMBER &&
-                      cur_rspec->size_in_wim != 0))
+               if (likely(!(reshdr.flags & WIM_RESHDR_FLAG_PACKED_STREAMS))
+                   || !cur_rspec
+                   || (reshdr.uncompressed_size == WIM_PACK_MAGIC_NUMBER &&
+                       cur_rspec->size_in_wim != 0))
                {
                        /* Finish previous resource (if existent)  */
                        if (cur_rspec) {
@@ -974,7 +974,6 @@ read_wim_lookup_table(WIMStruct *wim)
                        cur_entry->offset_in_res = 0;
                        cur_entry->size = reshdr.uncompressed_size;
                        cur_entry->flags = reshdr.flags;
-                       cur_rspec = NULL;
                }
                continue;