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:
authorHabib Gahbiche <zazizizou>2021-01-28 12:43:29 +0300
committerSergey Sharybin <sergey@blender.org>2021-01-28 12:43:46 +0300
commit51c8d53a7d0e1dfa151482420e2b19ae2ee10c9b (patch)
tree03868f9af6e033345097b925c0dfd20be8050f00
parent61d1fd7e2f8b972b903fa6684114a13f652fd507 (diff)
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
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp1
4 files changed, 4 insertions, 0 deletions
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);