aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-07-20 03:18:46 -0700
committerChris Robinson <[email protected]>2011-07-20 03:18:46 -0700
commit36446f3a584fdb7668746025c36d07ab6bf36da4 (patch)
tree543ae191bc45193c8401bbff0784a79112579d9c
parent5a484f7493c2c4151df80d9399589515e096575d (diff)
Make sure source vectors are finite values
-rw-r--r--OpenAL32/alSource.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index cf7c8842..522c39f8 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -406,24 +406,39 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum eParam, ALfloat flVal
switch(eParam)
{
case AL_POSITION:
- Source->vPosition[0] = flValue1;
- Source->vPosition[1] = flValue2;
- Source->vPosition[2] = flValue3;
- Source->NeedsUpdate = AL_TRUE;
+ if(isfinite(flValue1) && isfinite(flValue2) && isfinite(flValue3))
+ {
+ Source->vPosition[0] = flValue1;
+ Source->vPosition[1] = flValue2;
+ Source->vPosition[2] = flValue3;
+ Source->NeedsUpdate = AL_TRUE;
+ }
+ else
+ alSetError(pContext, AL_INVALID_VALUE);
break;
case AL_VELOCITY:
- Source->vVelocity[0] = flValue1;
- Source->vVelocity[1] = flValue2;
- Source->vVelocity[2] = flValue3;
- Source->NeedsUpdate = AL_TRUE;
+ if(isfinite(flValue1) && isfinite(flValue2) && isfinite(flValue3))
+ {
+ Source->vVelocity[0] = flValue1;
+ Source->vVelocity[1] = flValue2;
+ Source->vVelocity[2] = flValue3;
+ Source->NeedsUpdate = AL_TRUE;
+ }
+ else
+ alSetError(pContext, AL_INVALID_VALUE);
break;
case AL_DIRECTION:
- Source->vOrientation[0] = flValue1;
- Source->vOrientation[1] = flValue2;
- Source->vOrientation[2] = flValue3;
- Source->NeedsUpdate = AL_TRUE;
+ if(isfinite(flValue1) && isfinite(flValue2) && isfinite(flValue3))
+ {
+ Source->vOrientation[0] = flValue1;
+ Source->vOrientation[1] = flValue2;
+ Source->vOrientation[2] = flValue3;
+ Source->NeedsUpdate = AL_TRUE;
+ }
+ else
+ alSetError(pContext, AL_INVALID_VALUE);
break;
default: