diff options
author | Chris Robinson <[email protected]> | 2011-07-20 03:18:46 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-07-20 03:18:46 -0700 |
commit | 36446f3a584fdb7668746025c36d07ab6bf36da4 (patch) | |
tree | 543ae191bc45193c8401bbff0784a79112579d9c /OpenAL32/alSource.c | |
parent | 5a484f7493c2c4151df80d9399589515e096575d (diff) |
Make sure source vectors are finite values
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 39 |
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: |