From 1be30f35a68a9fb2c156ded45c8689cc44f26f29 Mon Sep 17 00:00:00 2001 From: Juan Linietsky <reduzio@gmail.com> Date: Mon, 21 Aug 2017 11:20:13 -0300 Subject: Fix binary object marshalling, closes #9472 --- core/io/marshalls.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/io') diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index c5d59f786d..e701a89c78 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -807,11 +807,16 @@ static void _encode_string(const String &p_string, uint8_t *&buf, int &r_len) { encode_uint32(utf8.length(), buf); buf += 4; copymem(buf, utf8.get_data(), utf8.length()); + buf += utf8.length(); } r_len += 4 + utf8.length(); - while (r_len % 4) + while (r_len % 4) { r_len++; //pad + if (buf) { + buf++; + } + } } Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_object_as_id) { -- cgit v1.2.3