Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-09-23 18:38:56 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-09-23 18:48:16 +0300
commitd7f803f522237be41c6ede50dde38b3d6795b161 (patch)
tree43f3c3a7a2e4a9301685e2bc88603467f6bfd243 /intern/cycles/integrator/shader_eval.cpp
parent6279efbb78a3c701547b8e25cf90efd712c377d0 (diff)
Fix T91641: crash rendering with 16k environment map in Cycles
Protect against integer overflow.
Diffstat (limited to 'intern/cycles/integrator/shader_eval.cpp')
-rw-r--r--intern/cycles/integrator/shader_eval.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/intern/cycles/integrator/shader_eval.cpp b/intern/cycles/integrator/shader_eval.cpp
index d35ff4cd03f..a14e41ec5be 100644
--- a/intern/cycles/integrator/shader_eval.cpp
+++ b/intern/cycles/integrator/shader_eval.cpp
@@ -149,14 +149,14 @@ bool ShaderEval::eval_gpu(Device *device,
/* Execute work on GPU in chunk, so we can cancel.
* TODO : query appropriate size from device.*/
- const int chunk_size = 65536;
+ const int64_t chunk_size = 65536;
- const int work_size = output.size();
+ const int64_t work_size = output.size();
void *d_input = (void *)input.device_pointer;
void *d_output = (void *)output.device_pointer;
- for (int d_offset = 0; d_offset < work_size; d_offset += chunk_size) {
- int d_work_size = min(chunk_size, work_size - d_offset);
+ for (int64_t d_offset = 0; d_offset < work_size; d_offset += chunk_size) {
+ int64_t d_work_size = std::min(chunk_size, work_size - d_offset);
void *args[] = {&d_input, &d_output, &d_offset, &d_work_size};
queue->enqueue(kernel, d_work_size, args);