From bc5975b86ee34a4784dc38f37028ea783dfa45da Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 30 May 2015 15:48:06 -0500 Subject: [PATCH] write.c: handle empty buffers in write_wim_resource_from_buffer() --- src/write.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/write.c b/src/write.c index d0ede8bb..5bd8db91 100644 --- a/src/write.c +++ b/src/write.c @@ -1747,6 +1747,13 @@ write_wim_resource_from_buffer(const void *buf, int ret; struct blob_descriptor blob; + if (unlikely(buf_size == 0)) { + zero_reshdr(out_reshdr); + if (hash_ret) + copy_hash(hash_ret, zero_hash); + return 0; + } + blob_set_is_located_in_attached_buffer(&blob, (void *)buf, buf_size); sha1_buffer(buf, buf_size, blob.hash); blob.unhashed = 0; -- 2.43.0