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:
@@ -25,6 +25,8 @@
|
||||
#include "COM_NodeOperation.h"
|
||||
#include "COM_QualityStepHelper.h"
|
||||
|
||||
#define MAX_GAUSSTAB_RADIUS 30000
|
||||
|
||||
class BlurBaseOperation : public NodeOperation, public QualityStepHelper {
|
||||
private:
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user