aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2005-01-20 12:56:27 +0000
committerTravis Howell2005-01-20 12:56:27 +0000
commitb9356bbe1485fa5744ce036bb72570b1574069d9 (patch)
tree9cd962197a5854247c0d691ce2bbecd5375e3c3c
parentca58bfed3bb8a31bfd88b84ad376186b1ef83cce (diff)
downloadscummvm-rg350-b9356bbe1485fa5744ce036bb72570b1574069d9.tar.gz
scummvm-rg350-b9356bbe1485fa5744ce036bb72570b1574069d9.tar.bz2
scummvm-rg350-b9356bbe1485fa5744ce036bb72570b1574069d9.zip
Check for negative sound offset.
svn-id: r16602
-rw-r--r--scumm/sound.cpp6
-rw-r--r--scumm/sound.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index d9bd683011..dc0b2cad65 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -215,7 +215,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
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 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
}
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;
diff --git a/scumm/sound.h b/scumm/sound.h
index 16d1e7b738..4e401ab733 100644
--- a/scumm/sound.h
+++ b/scumm/sound.h
@@ -93,11 +93,11 @@ public:
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);