mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- added proper range check to the main sound playing function.
We got a report where this crashed on a bad sound index.
This commit is contained in:
parent
63fa01205f
commit
64ef03428d
2 changed files with 2 additions and 2 deletions
|
@ -388,7 +388,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
FVector3 pos, vel;
|
||||
FRolloffInfo *rolloff;
|
||||
|
||||
if (sound_id <= 0 || volume <= 0 || nosfx || !SoundEnabled() || blockNewSounds)
|
||||
if (sound_id <= 0 || volume <= 0 || nosfx || !SoundEnabled() || blockNewSounds || (unsigned)sound_id >= S_sfx.Size())
|
||||
return NULL;
|
||||
|
||||
// prevent crashes.
|
||||
|
|
|
@ -416,7 +416,7 @@ static int S_AddSound (const char *logicalname, int lumpnum, FScanner *sc)
|
|||
|
||||
sfxid = soundEngine->FindSoundNoHash (logicalname);
|
||||
|
||||
if (sfxid > 0)
|
||||
if ((unsigned int)sfxid < S_sfx.Size())
|
||||
{ // If the sound has already been defined, change the old definition
|
||||
sfxinfo_t *sfx = &S_sfx[sfxid];
|
||||
|
||||
|
|
Loading…
Reference in a new issue