Prevent copy in texture upload with invalid input

Skip the memcpy when src is null.

Also silences a Codechecker warning.

Pick-to: 6.0
Change-Id: I5042d725000cb6dff6864408fa9ed9e0ca35145a
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
This commit is contained in:
Laszlo Agocs 2020-12-14 14:24:00 +01:00
parent 494da40f29
commit 796de4f066

View File

@ -2923,8 +2923,10 @@ void QRhiVulkan::prepareUploadSubres(QVkTexture *texD, int layer, int level,
qWarning("Invalid texture upload for %p layer=%d mip=%d", texD, layer, level);
}
if (src) {
memcpy(reinterpret_cast<char *>(mp) + *curOfs, src, size_t(copySizeBytes));
*curOfs += aligned(VkDeviceSize(imageSizeBytes), texbufAlign);
}
}
void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates)