summaryrefslogtreecommitdiff
path: root/src/client/snd_codec_wav.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/snd_codec_wav.c')
-rw-r--r--src/client/snd_codec_wav.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/snd_codec_wav.c b/src/client/snd_codec_wav.c
index 281a0023..e38b360e 100644
--- a/src/client/snd_codec_wav.c
+++ b/src/client/snd_codec_wav.c
@@ -133,6 +133,7 @@ static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info)
{
char dump[16];
int wav_format;
+ int bits;
int fmtlen = 0;
// skip the riff wav header
@@ -151,7 +152,15 @@ static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info)
info->rate = FGetLittleLong(file);
FGetLittleLong(file);
FGetLittleShort(file);
- info->width = FGetLittleShort(file) / 8;
+ bits = FGetLittleShort(file);
+
+ if( bits < 8 )
+ {
+ Com_Printf( S_COLOR_RED "ERROR: Less than 8 bit sound is not supported\n");
+ return qfalse;
+ }
+
+ info->width = bits / 8;
info->dataofs = 0;
// Skip the rest of the format chunk if required