[Bf-blender-cvs] [9c412b6e2d4] master: Fix possible integer overflow in Cycles baking

Sergey Sharybin noreply at git.blender.org
Wed Oct 13 11:20:30 CEST 2021


Commit: 9c412b6e2d4d5ae3c0cbd4a8d0249a3c12c6bd65
Author: Sergey Sharybin
Date:   Wed Oct 13 10:06:30 2021 +0200
Branches: master
https://developer.blender.org/rB9c412b6e2d4d5ae3c0cbd4a8d0249a3c12c6bd65

Fix possible integer overflow in Cycles baking

Ensure math happens on size_t type instead of int followed by a cast
to the size_t.

===================================================================

M	intern/cycles/integrator/pass_accessor.cpp

===================================================================

diff --git a/intern/cycles/integrator/pass_accessor.cpp b/intern/cycles/integrator/pass_accessor.cpp
index 4f76f1fa9df..4a0b1ed6ece 100644
--- a/intern/cycles/integrator/pass_accessor.cpp
+++ b/intern/cycles/integrator/pass_accessor.cpp
@@ -96,7 +96,7 @@ static void pad_pixels(const BufferParams &buffer_params,
     return;
   }
 
-  const size_t size = buffer_params.width * buffer_params.height;
+  const size_t size = static_cast<size_t>(buffer_params.width) * buffer_params.height;
   if (destination.pixels) {
     float *pixel = destination.pixels;



More information about the Bf-blender-cvs mailing list