Przeglądaj źródła

Initialize padding on PoolByteArray serialization

(cherry picked from commit c35f4e880868131d442394f1c00b572a55d0ee28)
Lukas Zanner 6 lat temu
rodzic
commit
7022e02d4d
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      core/io/marshalls.cpp

+ 5 - 1
core/io/marshalls.cpp

@@ -1230,11 +1230,15 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
 				buf += 4;
 				PoolVector<uint8_t>::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: {