From c35f4e880868131d442394f1c00b572a55d0ee28 Mon Sep 17 00:00:00 2001 From: Lukas Zanner Date: Sun, 19 May 2019 19:09:16 +0200 Subject: [PATCH] Initialize padding on PoolByteArray serialization --- core/io/marshalls.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 81b3829ffc6..d1b6b82cf0e 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -1231,11 +1231,15 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo buf += 4; PoolVector::Read r = data.read(); copymem(buf, &r[0], datalen * datasize); + buf += datalen * datasize; } r_len += 4 + datalen * datasize; - while (r_len % 4) + while (r_len % 4) { r_len++; + if (buf) + *(buf++) = 0; + } } break; case Variant::POOL_INT_ARRAY: {