Initialize padding on PoolByteArray serialization

(cherry picked from commit c35f4e8808)
This commit is contained in:
Lukas Zanner 2019-05-19 19:09:16 +02:00 committed by Rémi Verschelde
parent 6d57ebed1a
commit 7022e02d4d
1 changed files with 5 additions and 1 deletions

View File

@ -1230,11 +1230,15 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
buf += 4; buf += 4;
PoolVector<uint8_t>::Read r = data.read(); PoolVector<uint8_t>::Read r = data.read();
copymem(buf, &r[0], datalen * datasize); copymem(buf, &r[0], datalen * datasize);
buf += datalen * datasize;
} }
r_len += 4 + datalen * datasize; r_len += 4 + datalen * datasize;
while (r_len % 4) while (r_len % 4) {
r_len++; r_len++;
if (buf)
*(buf++) = 0;
}
} break; } break;
case Variant::POOL_INT_ARRAY: { case Variant::POOL_INT_ARRAY: {