summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-08 01:50:22 +0200
committerGitHub <noreply@github.com>2021-04-08 01:50:22 +0200
commit262a70223f0ef9a7cce2f8106e70401fba477e19 (patch)
tree4d225ed6a11ea0984387a973d47793729264c5f8
parentMerge pull request #6159 from Morph1984/acc-update-12.x (diff)
parentnvhost_ctrl_gpu: Avoid sending null pointer to memcpy (diff)
downloadyuzu-262a70223f0ef9a7cce2f8106e70401fba477e19.tar
yuzu-262a70223f0ef9a7cce2f8106e70401fba477e19.tar.gz
yuzu-262a70223f0ef9a7cce2f8106e70401fba477e19.tar.bz2
yuzu-262a70223f0ef9a7cce2f8106e70401fba477e19.tar.lz
yuzu-262a70223f0ef9a7cce2f8106e70401fba477e19.tar.xz
yuzu-262a70223f0ef9a7cce2f8106e70401fba477e19.tar.zst
yuzu-262a70223f0ef9a7cce2f8106e70401fba477e19.zip
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
index 933d42f3f..2edd803f3 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
@@ -248,7 +248,13 @@ NvResult nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<
IoctlZbcSetTable params{};
std::memcpy(&params, input.data(), input.size());
// TODO(ogniK): What does this even actually do?
- std::memcpy(output.data(), &params, output.size());
+
+ // Prevent null pointer being passed as arg 1
+ if (output.empty()) {
+ LOG_WARNING(Service_NVDRV, "Avoiding passing null pointer to memcpy");
+ } else {
+ std::memcpy(output.data(), &params, output.size());
+ }
return NvResult::Success;
}