Merge pull request #262 from Azaezel/alpha40_reverbBlurb

fix reverb out of bound initializations
This commit is contained in:
Brian Roberts 2020-07-30 11:49:51 -05:00 committed by GitHub
commit 9e792845f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 28 deletions

View file

@ -1120,7 +1120,7 @@ bool WaterObject::initMaterial( S32 idx )
// We must return false for any case which it is NOT safe for the caller // We must return false for any case which it is NOT safe for the caller
// to use the indexed material. // to use the indexed material.
if ( idx < 0 || idx > NumMatTypes ) if ( idx < 0 || idx >= NumMatTypes )
return false; return false;
BaseMatInstance *mat = mMatInstances[idx]; BaseMatInstance *mat = mMatInstances[idx];

View file

@ -440,7 +440,7 @@ S32 GuiParticleGraphCtrl::getSelectedPoint()
bool GuiParticleGraphCtrl::isExistingPoint(S32 plotID, S32 sample) bool GuiParticleGraphCtrl::isExistingPoint(S32 plotID, S32 sample)
{ {
if (((plotID < 0) || (plotID > MaxPlots)) || ((sample < 0) || (sample > MaxDataPoints)) || (sample >= mPlots[plotID].mGraphData.size())) if (((plotID < 0) || (plotID >= MaxPlots)) || ((sample < 0) || (sample > MaxDataPoints)) || (sample >= mPlots[plotID].mGraphData.size()))
{ {
return false; return false;
} else } else
@ -455,7 +455,7 @@ Point2F GuiParticleGraphCtrl::getPlotPoint(S32 plotID, S32 sample)
val.x = -1; val.x = -1;
val.y = -1; val.y = -1;
if (((plotID < 0) || (plotID > MaxPlots)) || ((sample < 0) || (sample > MaxDataPoints))) if (((plotID < 0) || (plotID >= MaxPlots)) || ((sample < 0) || (sample > MaxDataPoints)))
{ {
return val; return val;
} }
@ -465,7 +465,7 @@ Point2F GuiParticleGraphCtrl::getPlotPoint(S32 plotID, S32 sample)
S32 GuiParticleGraphCtrl::getPlotIndex(S32 plotID, F32 x, F32 y) S32 GuiParticleGraphCtrl::getPlotIndex(S32 plotID, F32 x, F32 y)
{ {
if ((plotID < 0) || (plotID > MaxPlots)) if ((plotID < 0) || (plotID >= MaxPlots))
{ {
return -1; return -1;
} }
@ -1022,7 +1022,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setSelectedPlot, void, (S32 plotID), ,
"Set the selected plot (a.k.a. graph)." "Set the selected plot (a.k.a. graph)."
"@return No return value" ) "@return No return value" )
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1034,7 +1034,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, clearGraph, void, (S32 plotID), , "(int
"Clear the graph of the given plot." "Clear the graph of the given plot."
"@return No return value") "@return No return value")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1054,7 +1054,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, addPlotPoint, S32, (S32 plotID, F32 x,
"@return") "@return")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return -2; return -2;
@ -1069,7 +1069,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S32
"@param x,y The plot position.\n" "@param x,y The plot position.\n"
"@return No return value.") "@return No return value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1084,7 +1084,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, changePlotPoint, S32, (S32 plotID, S32
"@param x,y The plot position.\n" "@param x,y The plot position.\n"
"@return No return value.") "@return No return value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return -1; return -1;
@ -1110,7 +1110,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (S32 plotID, S32
"@return Returns true or false whether or not the point in the plot passed is an existing point.") "@return Returns true or false whether or not the point in the plot passed is an existing point.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
} }
@ -1126,7 +1126,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (S32 plotID, S32
"@return The data point ID") "@return The data point ID")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
} }
@ -1146,7 +1146,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x,
"@return Returns the index of the point.\n") "@return Returns the index of the point.\n")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
} }
@ -1158,7 +1158,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, getGraphColor, LinearColorF, (S32 plotI
"@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"") "@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
} }
@ -1172,7 +1172,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, getGraphMin, Point2F, (S32 plotID), , "
"@return Returns the minimum of the range formatted as \"x-min y-min\"") "@return Returns the minimum of the range formatted as \"x-min y-min\"")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
} }
@ -1184,7 +1184,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (S32 plotID), , "
"@return Returns the maximum of the range formatted as \"x-max y-max\"") "@return Returns the maximum of the range formatted as \"x-max y-max\"")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
} }
@ -1197,7 +1197,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID)
"@return Returns the name of the plot") "@return Returns the name of the plot")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
} }
@ -1216,7 +1216,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setGraphMin, void, (S32 plotID, F32 min
"@return No return value.") "@return No return value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1232,7 +1232,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setGraphMinX, void, (S32 plotID, F32 mi
"@return No return Value.") "@return No return Value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1248,7 +1248,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setGraphMinY, void, (S32 plotID, F32 mi
"@return No return Value.") "@return No return Value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1264,7 +1264,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setGraphMax, void, (S32 plotID, F32 max
"@return No return value.") "@return No return value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1280,7 +1280,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setGraphMaxX, void, (S32 plotID, F32 ma
"@return No return Value.") "@return No return Value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1296,7 +1296,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setGraphMaxY, void, (S32 plotID, F32 ma
"@return No return Value.") "@return No return Value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1310,7 +1310,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setGraphHidden, void, (S32 plotID, bool
"@return No return value.") "@return No return value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;
@ -1362,7 +1362,7 @@ DefineEngineMethod(GuiParticleGraphCtrl, setGraphName, void, (S32 plotID, const
"@return No return value.") "@return No return value.")
{ {
if(plotID > object->MaxPlots) if(plotID >= object->MaxPlots)
{ {
Con::errorf("Invalid plotID."); Con::errorf("Invalid plotID.");
return; return;

View file

@ -368,10 +368,10 @@ public:
flDecayLFRatio = 0.0f; flDecayLFRatio = 0.0f;
flReflectionsGain = 0.0f; flReflectionsGain = 0.0f;
flReflectionsDelay = 0.0f; flReflectionsDelay = 0.0f;
flReflectionsPan[3] = 0.0f; dMemset(flReflectionsPan, 0, sizeof(flReflectionsPan));
flLateReverbGain = 0.0f; flLateReverbGain = 0.0f;
flLateReverbDelay = 0.0f; flLateReverbDelay = 0.0f;
flLateReverbPan[3] = 0.0f; dMemset(flLateReverbPan, 0, sizeof(flLateReverbPan));
flEchoTime = 0.0f; flEchoTime = 0.0f;
flEchoDepth = 0.0f; flEchoDepth = 0.0f;
flModulationTime = 0.0f; flModulationTime = 0.0f;
@ -472,10 +472,10 @@ public:
flDecayLFRatio = 0.0f; flDecayLFRatio = 0.0f;
flReflectionsGain = 0.0f; flReflectionsGain = 0.0f;
flReflectionsDelay = 0.0f; flReflectionsDelay = 0.0f;
flReflectionsPan[3] = 0.0f; dMemset(flReflectionsPan, 0, sizeof(flReflectionsPan));
flLateReverbGain = 0.0f; flLateReverbGain = 0.0f;
flLateReverbDelay = 0.0f; flLateReverbDelay = 0.0f;
flLateReverbPan[3] = 0.0f; dMemset(flLateReverbPan, 0, sizeof(flLateReverbPan));
flEchoTime = 0.0f; flEchoTime = 0.0f;
flEchoDepth = 0.0f; flEchoDepth = 0.0f;
flModulationTime = 0.0f; flModulationTime = 0.0f;