From: Eric Biggers Date: Thu, 25 Apr 2013 04:07:31 +0000 (-0500) Subject: Win32: Do not create lookup table entries for 0 length streams X-Git-Tag: v1.3.3~36 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=16aab5992bfe8c33e2815b4ce5c9ebd7ec130c21;hp=cbeb81145e2532bfcf3f5e58c6be000615f54953 Win32: Do not create lookup table entries for 0 length streams --- diff --git a/src/win32.c b/src/win32.c index 10f28b3d..1b2aeffe 100644 --- a/src/win32.c +++ b/src/win32.c @@ -876,6 +876,12 @@ win32_capture_stream(const wchar_t *path, } } + /* If zero length stream, no lookup table entry needed. */ + if ((u64)dat->StreamSize.QuadPart == 0) { + ret = 0; + goto out; + } + /* Create a UTF-16LE string @spath that gives the filename, then a * colon, then the stream name. Or, if it's an unnamed stream, just the * filename. It is MALLOC()'ed so that it can be saved in the diff --git a/src/write.c b/src/write.c index 311eff9c..8b094490 100644 --- a/src/write.c +++ b/src/write.c @@ -94,6 +94,8 @@ begin_wim_resource_chunk_tab(const struct wim_lookup_table_entry *lte, size_t alloc_size = sizeof(struct chunk_table) + num_chunks * sizeof(u64); struct chunk_table *chunk_tab = CALLOC(1, alloc_size); + DEBUG("Begin chunk table for stream with size %"PRIu64, size); + if (!chunk_tab) { ERROR("Failed to allocate chunk table for %"PRIu64" byte " "resource", size);