[Bf-blender-cvs] [51c8d53a7d0] blender-v2.92-release: Fix T84512: Crash if size input of Blur node is too large

Habib Gahbiche noreply at git.blender.org
Thu Jan 28 10:54:14 CET 2021


Commit: 51c8d53a7d0e1dfa151482420e2b19ae2ee10c9b
Author: Habib Gahbiche
Date:   Thu Jan 28 10:43:29 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rB51c8d53a7d0e1dfa151482420e2b19ae2ee10c9b

Fix T84512: Crash if size input of Blur node is too large

Gaussian filter with a too large kernel doesn't make much sense.
This commit caps the Gaussian function radius to MAX_GAUSSTAB_RADIUS.

Reviewed By: sergey

Maniphest Tasks: T84512

Differential Revision: https://developer.blender.org/D10122

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

M	source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
M	source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
M	source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
M	source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp

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

diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
index a7d8f030269..c47d3b52beb 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -68,6 +68,7 @@ void GaussianAlphaXBlurOperation::updateGauss()
   if (this->m_distbuf_inv == nullptr) {
     updateSize();
     float rad = max_ff(m_size * m_data.sizex, 0.0f);
+    rad = min_ff(rad, MAX_GAUSSTAB_RADIUS);
     m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
 
     m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff);
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index f1bc8751329..7a0dff73941 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -60,6 +60,7 @@ void GaussianAlphaYBlurOperation::updateGauss()
   if (this->m_gausstab == nullptr) {
     updateSize();
     float rad = max_ff(m_size * m_data.sizey, 0.0f);
+    rad = min_ff(rad, MAX_GAUSSTAB_RADIUS);
     m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
 
     m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index e4401b2a91c..e08d30e5ddf 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -66,6 +66,7 @@ void GaussianXBlurOperation::updateGauss()
   if (this->m_gausstab == nullptr) {
     updateSize();
     float rad = max_ff(m_size * m_data.sizex, 0.0f);
+    rad = min_ff(rad, MAX_GAUSSTAB_RADIUS);
     m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
 
     this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index 230538ba5e6..7710b065ccd 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -65,6 +65,7 @@ void GaussianYBlurOperation::updateGauss()
   if (this->m_gausstab == nullptr) {
     updateSize();
     float rad = max_ff(m_size * m_data.sizey, 0.0f);
+    rad = min_ff(rad, MAX_GAUSSTAB_RADIUS);
     m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS);
 
     this->m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize);



More information about the Bf-blender-cvs mailing list