[IE][VPU]: Use the string size, including the null-terminated character, to serialize the DataNode name (#1496)

This commit is contained in:
Nikita Kudriavtsev 2020-07-31 16:21:55 +03:00 committed by GitHub
parent 1c22023a8e
commit e27382070c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -217,13 +217,14 @@ void DataNode::serializeIOInfo(BlobSerializer& serializer) const {
serializer.append(checked_cast<uint32_t>(ioBufferOffset));
auto nameLength = checked_cast<uint32_t>(_name.length());
auto nameLengthAligned = alignVal(nameLength, 16u);
auto nameSize = nameLength + 1; // required to support c-string when the name length is multiple of 16
auto nameSizeAligned = alignVal(nameSize, 16u);
serializer.append(nameLengthAligned);
serializer.append(nameSizeAligned);
for (auto c : _name) {
serializer.append(c);
}
for (uint32_t i = 0; i < nameLengthAligned - nameLength; ++i) {
for (uint32_t i = 0; i < nameSizeAligned - nameLength; ++i) {
serializer.append(uint8_t(0));
}