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.
This commit is contained in:
Sergey Sharybin
2013-05-13 11:52:04 +00:00
parent e40d403e43
commit 356d4c3085
5 changed files with 12 additions and 20 deletions

View File

@@ -25,6 +25,8 @@
#include "COM_NodeOperation.h"
#include "COM_QualityStepHelper.h"
#define MAX_GAUSSTAB_RADIUS 30000
class BlurBaseOperation : public NodeOperation, public QualityStepHelper {
private:

View File

@@ -55,8 +55,7 @@ void GaussianAlphaXBlurOperation::initExecution()
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 @@ void GaussianAlphaXBlurOperation::updateGauss()
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 @@ void GaussianAlphaXBlurOperation::updateGauss()
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);

View File

@@ -55,8 +55,7 @@ void GaussianAlphaYBlurOperation::initExecution()
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 @@ void GaussianAlphaYBlurOperation::updateGauss()
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 @@ void GaussianAlphaYBlurOperation::updateGauss()
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);

View File

@@ -53,8 +53,7 @@ void GaussianXBlurOperation::initExecution()
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 @@ void GaussianXBlurOperation::updateGauss()
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);

View File

@@ -53,8 +53,7 @@ void GaussianYBlurOperation::initExecution()
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 @@ void GaussianYBlurOperation::updateGauss()
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);