aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-02-21 22:29:29 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-02-21 22:29:29 +0000
commit9ec904ab35ebef36095a70adf304030eb4004dc3 (patch)
tree83e18e9cfced59d7c6b481cdfe8f18cf8d294171 /code
parent62082759a0278c00cc44c465b1a72aaacddd02c9 (diff)
downloadioquake3-aero-9ec904ab35ebef36095a70adf304030eb4004dc3.tar.gz
ioquake3-aero-9ec904ab35ebef36095a70adf304030eb4004dc3.zip
* Fix to half of bug #2600 (Refuse to load RIFF files with less than 8 bits per
sample) git-svn-id: svn://svn.icculus.org/quake3/trunk@580 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/client/snd_codec_wav.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/code/client/snd_codec_wav.c b/code/client/snd_codec_wav.c
index a60f3da..a020841 100644
--- a/code/client/snd_codec_wav.c
+++ b/code/client/snd_codec_wav.c
@@ -132,6 +132,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
@@ -150,7 +151,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