summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-12-14 14:24:00 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-12-16 18:18:19 +0100
commit796de4f0668cc4b38f9e8653a0b2f53f0b3423b9 (patch)
treea46911611c5ad27aecff8759b6e8ba7d2cfa71cc /src/gui
parent494da40f2945bd19449c210c25f7c41fd408d1cd (diff)
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>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/rhi/qrhivulkan.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index f867781d8b..232b1be408 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -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);
}
- memcpy(reinterpret_cast<char *>(mp) + *curOfs, src, size_t(copySizeBytes));
- *curOfs += aligned(VkDeviceSize(imageSizeBytes), texbufAlign);
+ if (src) {
+ memcpy(reinterpret_cast<char *>(mp) + *curOfs, src, size_t(copySizeBytes));
+ *curOfs += aligned(VkDeviceSize(imageSizeBytes), texbufAlign);
+ }
}
void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates)