Skip to content

Commit

Permalink
Fix some minor KEYCONV and VOC memory issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Talon1024 authored and coelckers committed Apr 20, 2024
1 parent 06eee55 commit c03b272
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/common/audio/sound/s_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,8 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx)
{
auto sfxp = sfxdata.data();
int32_t dmxlen = LittleLong(((int32_t *)sfxp)[1]);

// If the sound is voc, use the custom loader.
if (memcmp (sfxp, "Creative Voice File", 19) == 0)
if (size > 19 && memcmp (sfxp, "Creative Voice File", 19) == 0)
{
sfx->data = GSnd->LoadSoundVoc(sfxp, size);
}
Expand Down
6 changes: 3 additions & 3 deletions src/gamedata/keysections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,22 @@ void D_LoadWadSettings ()

while (conf < eof)
{
size_t i;
size_t i = 0;

// Fetch a line to execute
command.Clear();
for (i = 0; conf + i < eof && conf[i] != '\n'; ++i)
{
command.Push(conf[i]);
}
if (i == 0)
if (i == 0) // Blank line
{
conf++;
continue;
}
command.Push(0);
conf += i;
if (*conf == '\n')
if (conf >= eof || *conf == '\n')
{
conf++;
}
Expand Down

0 comments on commit c03b272

Please sign in to comment.