From 3f41b0dc0bcf3cf8f9f12f3389401d958a8cb6c8 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sat, 15 Jun 2024 12:49:40 +0200 Subject: [PATCH] Fix potential infinite loop in S_PaintChannels when playing sounds with loop start >= end (e.g. misc/forcefield.wav from Madfox's kaptlog.zip) --- Quake/snd_mem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Quake/snd_mem.c b/Quake/snd_mem.c index 239e020b7..8ff259711 100644 --- a/Quake/snd_mem.c +++ b/Quake/snd_mem.c @@ -345,6 +345,12 @@ wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength) else info.samples = samples; + if (info.loopstart >= info.samples) + { + Con_Warning ("%s has loop start >= end\n", name); + info.loopstart = -1; + } + info.dataofs = data_p - wav; return info;