[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52512] trunk/blender/source/blender/ compositor/operations: Fix usage of uninialized memory in some operations

Sergey Sharybin sergey.vfx at gmail.com
Fri Nov 23 13:51:01 CET 2012


Revision: 52512
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52512
Author:   nazgul
Date:     2012-11-23 12:50:59 +0000 (Fri, 23 Nov 2012)
Log Message:
-----------
Fix usage of uninialized memory in some operations

- FastGaussianBlurValueOperation is a value operation, so use only first vector
  component in initializeTileData.

- Gamma correct/uncorrect operations didn't set alpha for output which lead to
  usage of uninitialzied memory further in nodes graph.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp

Modified: trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp	2012-11-23 12:42:01 UTC (rev 52511)
+++ trunk/blender/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp	2012-11-23 12:50:59 UTC (rev 52512)
@@ -281,7 +281,7 @@
 		if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) {
 			float *src = newBuf->getBuffer();
 			float *dst = copy->getBuffer();
-			for (int i = copy->getWidth() * copy->getHeight() * COM_NUMBER_OF_CHANNELS; i != 0; i--, src++, dst++) {
+			for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--, src += COM_NUMBER_OF_CHANNELS, dst += COM_NUMBER_OF_CHANNELS) {
 				if (*src < *dst) {
 					*dst = *src;
 				}
@@ -290,7 +290,7 @@
 		else if (this->m_overlay == FAST_GAUSS_OVERLAY_MAX) {
 			float *src = newBuf->getBuffer();
 			float *dst = copy->getBuffer();
-			for (int i = copy->getWidth() * copy->getHeight() * COM_NUMBER_OF_CHANNELS; i != 0; i--, src++, dst++) {
+			for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--, src += COM_NUMBER_OF_CHANNELS, dst += COM_NUMBER_OF_CHANNELS) {
 				if (*src > *dst) {
 					*dst = *src;
 				}

Modified: trunk/blender/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp	2012-11-23 12:42:01 UTC (rev 52511)
+++ trunk/blender/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp	2012-11-23 12:50:59 UTC (rev 52512)
@@ -48,6 +48,7 @@
 	output[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f;
 	output[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f;
 	output[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f;
+	output[3] = inputColor[3];
 
 	if (inputColor[3] > 0.0f) {
 		output[0] *= inputColor[3];
@@ -86,6 +87,7 @@
 	output[0] = inputColor[0] > 0.0f ? sqrtf(inputColor[0]) : 0.0f;
 	output[1] = inputColor[1] > 0.0f ? sqrtf(inputColor[1]) : 0.0f;
 	output[2] = inputColor[2] > 0.0f ? sqrtf(inputColor[2]) : 0.0f;
+	output[3] = inputColor[3];
 
 	if (inputColor[3] > 0.0f) {
 		output[0] *= inputColor[3];




More information about the Bf-blender-cvs mailing list