From: Eric Biggers Date: Sat, 30 May 2015 20:48:06 +0000 (-0500) Subject: write.c: handle empty buffers in write_wim_resource_from_buffer() X-Git-Tag: v1.8.2~114 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=bc5975b86ee34a4784dc38f37028ea783dfa45da write.c: handle empty buffers in write_wim_resource_from_buffer() --- 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;