aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alAuxEffectSlot.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-09-21 14:41:43 -0700
committerChris Robinson <[email protected]>2010-09-21 14:41:43 -0700
commit301a8ba3a403ece650790d015995a56f27718115 (patch)
tree93209e28addade1840459e18624ea0639fa17b2e /OpenAL32/alAuxEffectSlot.c
parent2d4453968d67af5cfee81c09adcc7b1ac6bd03f6 (diff)
Improve some range checks
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r--OpenAL32/alAuxEffectSlot.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index d8ccaf71..9c5cf5fc 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -45,11 +45,13 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
Context = GetContextSuspended();
if(!Context) return;
- if(n > 0)
+ if(n < 0)
+ alSetError(Context, AL_INVALID_VALUE);
+ else
{
ALCdevice *Device = Context->Device;
- if(Context->EffectSlotMap.size+n <= (ALsizei)Device->AuxiliaryEffectSlotMax)
+ if((ALuint)n <= Device->AuxiliaryEffectSlotMax - Context->EffectSlotMap.size)
{
// Check that enough memory has been allocted in the 'effectslots' array for n Effect Slots
if(!IsBadWritePtr((void*)effectslots, n * sizeof(ALuint)))