r580 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Feb 21 17:29:29 EST 2006


Author: tma
Date: 2006-02-21 17:29:29 -0500 (Tue, 21 Feb 2006)
New Revision: 580

Modified:
   trunk/code/client/snd_codec_wav.c
Log:
* Fix to half of bug #2600 (Refuse to load RIFF files with less than 8 bits per
  sample)


Modified: trunk/code/client/snd_codec_wav.c
===================================================================
--- trunk/code/client/snd_codec_wav.c	2006-02-21 22:13:36 UTC (rev 579)
+++ trunk/code/client/snd_codec_wav.c	2006-02-21 22:29:29 UTC (rev 580)
@@ -132,6 +132,7 @@
 {
 	char dump[16];
 	int wav_format;
+	int bits;
 	int fmtlen = 0;
 
 	// skip the riff wav header
@@ -150,7 +151,15 @@
 	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




More information about the quake3-commits mailing list