summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/amd/amd_gpu/gpu.cpp
diff options
context:
space:
mode:
authorpsychocrypt <psychocrypt@users.noreply.github.com>2017-10-06 21:46:22 +0200
committerpsychocrypt <psychocrypt@users.noreply.github.com>2017-10-06 21:50:51 +0200
commit611378eb968eeda5700fe257a27d87856aa112f0 (patch)
treece72a5e86dde404112be00a14150d128096b6f93 /xmrstak/backend/amd/amd_gpu/gpu.cpp
parent83752eccc06e1d5f892961a5e9efd931403ab559 (diff)
downloadxmr-stak-611378eb968eeda5700fe257a27d87856aa112f0.zip
xmr-stak-611378eb968eeda5700fe257a27d87856aa112f0.tar.gz
avoid possible illegal memory access
Is is possible that the number of results are greater than the result output array, in this case invalid memory can be access within the device and on the host side.
Diffstat (limited to 'xmrstak/backend/amd/amd_gpu/gpu.cpp')
-rw-r--r--xmrstak/backend/amd/amd_gpu/gpu.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/xmrstak/backend/amd/amd_gpu/gpu.cpp b/xmrstak/backend/amd/amd_gpu/gpu.cpp
index d43961e..ca81718 100644
--- a/xmrstak/backend/amd/amd_gpu/gpu.cpp
+++ b/xmrstak/backend/amd/amd_gpu/gpu.cpp
@@ -912,6 +912,10 @@ size_t XMRRunJob(GpuContext* ctx, cl_uint* HashOutput)
}
clFinish(ctx->CommandQueues);
+ auto & numHashValues = HashOutput[0xFF];
+ // avoid out of memory read, we have only storage for 0xFF results
+ if(numHashValues > 0xFF)
+ numHashValues = 0xFF;
ctx->Nonce += g_intensity;
return ERR_SUCCESS;
OpenPOWER on IntegriCloud