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:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-11-29 13:03:11 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-11-29 13:03:11 +0300
commit7ea2dedd59cbe009313a96421d70dc38f04f2096 (patch)
treea4a445f2ec0d3d72ca4b5ecd1de9cbc1ad447095 /intern/cycles/render/image.h
parentcc1a64be36f3dc862ad83ee3f4730a2b4c5649fd (diff)
Cycles: Pass extra array size argument to builtin image pixels functions
This is a way to avoid possible memory corruption when render threads works in parallel with UI thread. Not guarantees complete safe, but makes things easier to check anyway.
Diffstat (limited to 'intern/cycles/render/image.h')
-rw-r--r--intern/cycles/render/image.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 3da7338985c..47bbd92347c 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -86,9 +86,25 @@ public:
bool need_update;
- function<void(const string &filename, void *data, bool &is_float, int &width, int &height, int &depth, int &channels)> builtin_image_info_cb;
- function<bool(const string &filename, void *data, unsigned char *pixels)> builtin_image_pixels_cb;
- function<bool(const string &filename, void *data, float *pixels)> builtin_image_float_pixels_cb;
+ /* NOTE: Here pixels_size is a size of storage, which equals to
+ * width * height * depth.
+ * Use this to avoid some nasty memory corruptions.
+ */
+ function<void(const string &filename,
+ void *data,
+ bool &is_float,
+ int &width,
+ int &height,
+ int &depth,
+ int &channels)> builtin_image_info_cb;
+ function<bool(const string &filename,
+ void *data,
+ unsigned char *pixels,
+ const size_t pixels_size)> builtin_image_pixels_cb;
+ function<bool(const string &filename,
+ void *data,
+ float *pixels,
+ const size_t pixels_size)> builtin_image_float_pixels_cb;
struct Image {
string filename;