QRhiVulkan: fix random values in pipelineCacheData() result

The QVkPipelineCacheDataHeader::reserved field wasn't initializaed by
the code, but then memcpy()ed with the struct into the result
QByteArray. At best, this contains random data, at worst, it leaks
information.

Initialize it to zero.

Found by Coverity.

Amends df0e98d4080f50de7ecacdc4cae079ab31280481.

Pick-to: 6.5 6.2
Coverity-Id: 444147
Change-Id: I398c9a1e99483f2f9887d768319b20ecc11e2c86
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 2913e7de5186fc4fd3576167304c214d30f78d2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit bed03c10be8a93debfa0ee00c544efb2d966b742)
This commit is contained in:
Marc Mutz 2024-03-25 17:55:57 +01:00 committed by Qt Cherry-pick Bot
parent 29a75b99f4
commit 1d54d0252c

View File

@ -4569,6 +4569,7 @@ QByteArray QRhiVulkan::pipelineCacheData()
header.deviceId = physDevProperties.deviceID;
header.dataSize = quint32(dataSize);
header.uuidSize = VK_UUID_SIZE;
header.reserved = 0;
memcpy(data.data(), &header, headerSize);
memcpy(data.data() + headerSize, physDevProperties.pipelineCacheUUID, VK_UUID_SIZE);