Skip to content

Commit c03b272

Browse files
Talon1024coelckers
authored andcommitted
Fix some minor KEYCONV and VOC memory issues
1 parent 06eee55 commit c03b272

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/common/audio/sound/s_sound.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,8 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx)
749749
{
750750
auto sfxp = sfxdata.data();
751751
int32_t dmxlen = LittleLong(((int32_t *)sfxp)[1]);
752-
753752
// If the sound is voc, use the custom loader.
754-
if (memcmp (sfxp, "Creative Voice File", 19) == 0)
753+
if (size > 19 && memcmp (sfxp, "Creative Voice File", 19) == 0)
755754
{
756755
sfx->data = GSnd->LoadSoundVoc(sfxp, size);
757756
}

src/gamedata/keysections.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,22 +171,22 @@ void D_LoadWadSettings ()
171171

172172
while (conf < eof)
173173
{
174-
size_t i;
174+
size_t i = 0;
175175

176176
// Fetch a line to execute
177177
command.Clear();
178178
for (i = 0; conf + i < eof && conf[i] != '\n'; ++i)
179179
{
180180
command.Push(conf[i]);
181181
}
182-
if (i == 0)
182+
if (i == 0) // Blank line
183183
{
184184
conf++;
185185
continue;
186186
}
187187
command.Push(0);
188188
conf += i;
189-
if (*conf == '\n')
189+
if (conf >= eof || *conf == '\n')
190190
{
191191
conf++;
192192
}

0 commit comments

Comments
 (0)