From 16aab5992bfe8c33e2815b4ce5c9ebd7ec130c21 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 24 Apr 2013 23:07:31 -0500 Subject: [PATCH] Win32: Do not create lookup table entries for 0 length streams --- src/win32.c | 6 ++++++ src/write.c | 2 ++ 2 files changed, 8 insertions(+) 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); -- 2.43.0