[Bf-blender-cvs] [2982c9ba0a9] master: ColorManagement: Incorrect Memory Read for RGB images

Jeroen Bakker noreply at git.blender.org
Thu Mar 19 15:27:24 CET 2020


Commit: 2982c9ba0a9c2152cb676bc4bb71a319f8f18ad8
Author: Jeroen Bakker
Date:   Thu Mar 19 15:23:08 2020 +0100
Branches: master
https://developer.blender.org/rB2982c9ba0a9c2152cb676bc4bb71a319f8f18ad8

ColorManagement: Incorrect Memory Read for RGB images

When RGB images or BW images are converted to a GPU texture and color
space conversion was needed the images were read incorrectly.

This patch checks the correct amount of channels in the image and uses
that as the correct pixel stride.

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

M	source/blender/imbuf/intern/colormanagement.c

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

diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 2a458ba5474..a95db5c1de4 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2293,7 +2293,7 @@ void IMB_colormanagement_imbuf_to_float_texture(float *out_buffer,
   for (int y = 0; y < height; y++) {
     const size_t in_offset = (offset_y + y) * ibuf->x + offset_x;
     const size_t out_offset = y * width;
-    const float *in = in_buffer + in_offset * 4;
+    const float *in = in_buffer + in_offset * in_channels;
     float *out = out_buffer + out_offset * 4;
 
     if (in_channels == 1) {



More information about the Bf-blender-cvs mailing list