diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-23 16:50:59 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-23 16:50:59 +0400 |
commit | 587067b4fc74d92ceecab9f134dc04cca45b16b2 (patch) | |
tree | d304ba62d58adcefe7a1cd673b51281b1d6bd808 /source/blender/compositor | |
parent | 12f31472d682e303d83af0d3f35ce926696885bc (diff) |
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.
Diffstat (limited to 'source/blender/compositor')
-rw-r--r-- | source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp | 4 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_GammaCorrectOperation.cpp | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index 4bdb2591cb7..2ae80b4f207 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -281,7 +281,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) 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 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) 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; } diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp index c36a6f896c2..8f92dc02a57 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp @@ -48,6 +48,7 @@ void GammaCorrectOperation::executePixel(float output[4], float x, float y, Pixe 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 @@ void GammaUncorrectOperation::executePixel(float output[4], float x, float y, Pi 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]; |