diff options
author | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-10-06 21:46:22 +0200 |
---|---|---|
committer | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-10-06 21:50:51 +0200 |
commit | 611378eb968eeda5700fe257a27d87856aa112f0 (patch) | |
tree | ce72a5e86dde404112be00a14150d128096b6f93 /xmrstak/backend/amd/amd_gpu/gpu.cpp | |
parent | 83752eccc06e1d5f892961a5e9efd931403ab559 (diff) | |
download | xmr-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.cpp | 4 |
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; |