wimlib_split(): forbid splitting arbitrary WIMStructs
[wimlib] / src / split.c
index 6124a67da81c09317ca5c2ba993c05cb4f6e3067..07106746f484885cbe90771b0c139007400ab3f5 100644 (file)
@@ -219,6 +219,13 @@ wimlib_split(WIMStruct *wim, const tchar *swm_name,
                return WIMLIB_ERR_UNSUPPORTED;
        }
 
+       for (i = 0; i < wim->hdr.image_count; i++) {
+               if (!is_image_unchanged_from_wim(wim->image_metadata[i], wim)) {
+                       ERROR("Only an unmodified, on-disk WIM file can be split.");
+                       return WIMLIB_ERR_UNSUPPORTED;
+               }
+       }
+
        memset(&swm_info, 0, sizeof(swm_info));
        swm_info.max_part_size = part_size;