[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.411,1.412 sound.h,1.78,1.79

kirben kirben at users.sourceforge.net
Thu Jan 20 04:57:18 CET 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30461/scumm

Modified Files:
	sound.cpp sound.h 
Log Message:

Check for negative sound offset.


Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.411
retrieving revision 1.412
diff -u -d -r1.411 -r1.412
--- sound.cpp	10 Jan 2005 22:06:05 -0000	1.411
+++ sound.cpp	20 Jan 2005 12:56:24 -0000	1.412
@@ -215,7 +215,7 @@
 		size = musicFile.readUint32LE();
 
 		if (music_offs > total_size || (size + music_offs > total_size) || size < 0) {
-			warning("playSound: Bad music offsets");
+			warning("playSound: Invalid music offset (%d) in music %d", soundID);
 			musicFile.close();
 			return;
 		}
@@ -282,8 +282,8 @@
 		}
 
 		size = READ_BE_UINT32(ptr+4) - 8;
-		if (heOffset > size) {
-			warning("playSound: Bad sound offset");
+		if (heOffset < 0 || heOffset > size) {
+			warning("playSound: Invalid sound offset (%d) in sound %d", heOffset, soundID);
 			heOffset = 0;
 		} 
 		size -= heOffset;

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- sound.h	9 Jan 2005 03:15:58 -0000	1.78
+++ sound.h	20 Jan 2005 12:56:27 -0000	1.79
@@ -93,11 +93,11 @@
 public:
 	Sound(ScummEngine *parent);
 	~Sound();
-	void addSoundToQueue(int sound, int offset = 0, int channel = 0, int heFlags = 0);
-	void addSoundToQueue2(int sound, int offset = 0, int channel = 0, int heFlags = 0);
+	void addSoundToQueue(int sound, int heOffset = 0, int heChannel = 0, int heFlags = 0);
+	void addSoundToQueue2(int sound, int heOffset = 0, int heChannel = 0, int heFlags = 0);
 	void processSoundQues();
 	void setOverrideFreq(int freq);
-	void playSound(int sound, int offset = 0, int channel = 0, int heFlags = 0);
+	void playSound(int soundID, int heOffset, int heChannel, int heFlags);
 	void startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle *handle = NULL);
 	void stopTalkSound();
 	bool isMouthSyncOff(uint pos);





More information about the Scummvm-git-logs mailing list