Commit 4cba7dde authored by Jørgen Lind's avatar Jørgen Lind
Browse files

Validate chunk size before copying

parent 6d0f82c2
Pipeline #9789 passed with stages
in 6 minutes and 25 seconds
......@@ -376,6 +376,16 @@ bool DeserializeVolumeData(const std::vector<uint8_t> &serializedData, VolumeDat
void * source = dataBlockDescriptor + 1;
size_t sourceDataBlockSize = serializedData.size() - sizeof(*dataBlockDescriptor);
size_t requiredDataBlockSize = size_t(GetByteSize(*dataBlockDescriptor));
if (sourceDataBlockSize != requiredDataBlockSize)
{
error.string = "Required size of uncompressed chunk is not present. Possible data corruptions.";
error.code = -1;
return false;
}
int32_t byteSize = GetAllocatedByteSize(dataBlock);
destination.resize(byteSize);
CopyLinearBufferIntoDataBlock(source, dataBlock, destination);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment