Revision: 56759
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56759
Author:   nazgul
Date:     2013-05-13 11:52:04 +0000 (Mon, 13 May 2013)
Log Message:
-----------
Fix #35330: Blur node crash due to size overflow

Issue was caused by too hight value used for size,
which came from infinite Z-buffer point.

Solved the crash by clamoing maximal gaussian table
radius to 30K, which seems to be reasonable.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.h
    
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
    
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
    
trunk/blender/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
    
trunk/blender/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp

Modified: 
trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.h  
2013-05-13 11:21:33 UTC (rev 56758)
+++ trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.h  
2013-05-13 11:52:04 UTC (rev 56759)
@@ -25,6 +25,8 @@
 #include "COM_NodeOperation.h"
 #include "COM_QualityStepHelper.h"
 
+#define MAX_GAUSSTAB_RADIUS 30000
+
 class BlurBaseOperation : public NodeOperation, public QualityStepHelper {
 private:
 

Modified: 
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
===================================================================
--- 
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
      2013-05-13 11:21:33 UTC (rev 56758)
+++ 
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
      2013-05-13 11:52:04 UTC (rev 56759)
@@ -55,8 +55,7 @@
 
        if (this->m_sizeavailable) {
                float rad = this->m_size * this->m_data->sizex;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_gausstab = BlurBaseOperation::make_gausstab(rad);
@@ -69,8 +68,7 @@
        if (this->m_gausstab == NULL) {
                updateSize();
                float rad = this->m_size * this->m_data->sizex;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_gausstab = BlurBaseOperation::make_gausstab(rad);
@@ -79,8 +77,7 @@
        if (this->m_distbuf_inv == NULL) {
                updateSize();
                float rad = this->m_size * this->m_data->sizex;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_distbuf_inv = 
BlurBaseOperation::make_dist_fac_inverse(rad, this->m_falloff);

Modified: 
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
===================================================================
--- 
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
      2013-05-13 11:21:33 UTC (rev 56758)
+++ 
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
      2013-05-13 11:52:04 UTC (rev 56759)
@@ -55,8 +55,7 @@
 
        if (this->m_sizeavailable) {
                float rad = this->m_size * this->m_data->sizey;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_gausstab = BlurBaseOperation::make_gausstab(rad);
@@ -69,8 +68,7 @@
        if (this->m_gausstab == NULL) {
                updateSize();
                float rad = this->m_size * this->m_data->sizey;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_gausstab = BlurBaseOperation::make_gausstab(rad);
@@ -79,8 +77,7 @@
        if (this->m_distbuf_inv == NULL) {
                updateSize();
                float rad = this->m_size * this->m_data->sizex;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_distbuf_inv = 
BlurBaseOperation::make_dist_fac_inverse(rad, this->m_falloff);

Modified: 
trunk/blender/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
===================================================================
--- 
trunk/blender/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
   2013-05-13 11:21:33 UTC (rev 56758)
+++ 
trunk/blender/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
   2013-05-13 11:52:04 UTC (rev 56759)
@@ -53,8 +53,7 @@
 
        if (this->m_sizeavailable) {
                float rad = this->m_size * this->m_data->sizex;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_gausstab = BlurBaseOperation::make_gausstab(rad);
@@ -66,8 +65,7 @@
        if (this->m_gausstab == NULL) {
                updateSize();
                float rad = this->m_size * this->m_data->sizex;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_gausstab = BlurBaseOperation::make_gausstab(rad);

Modified: 
trunk/blender/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
===================================================================
--- 
trunk/blender/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
   2013-05-13 11:21:33 UTC (rev 56758)
+++ 
trunk/blender/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
   2013-05-13 11:52:04 UTC (rev 56759)
@@ -53,8 +53,7 @@
 
        if (this->m_sizeavailable) {
                float rad = this->m_size * this->m_data->sizey;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_gausstab = BlurBaseOperation::make_gausstab(rad);
@@ -66,8 +65,7 @@
        if (this->m_gausstab == NULL) {
                updateSize();
                float rad = this->m_size * this->m_data->sizey;
-               if (rad < 1)
-                       rad = 1;
+               CLAMP(rad, 1.0f, MAX_GAUSSTAB_RADIUS);
 
                this->m_rad = rad;
                this->m_gausstab = BlurBaseOperation::make_gausstab(rad);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to