diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-08-21 11:20:13 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-08-21 11:22:08 -0300 |
commit | 1be30f35a68a9fb2c156ded45c8689cc44f26f29 (patch) | |
tree | 1e5f696a556e856ed0135fca6c2f4a073c4fe3d3 /core/io | |
parent | d8cd849a431db4b5a5d8d61161062ca7cf101220 (diff) |
Fix binary object marshalling, closes #9472
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/marshalls.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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) { |