aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--engines/simon/midi.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 465e294dfb..c718036566 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
Simon
- Improved support for international versions of the Feeble Files.
+ - Fixed undefined behaviour when loading music.
Broken Sword 2
- More robust handling of the optional startup.inf file.
diff --git a/engines/simon/midi.cpp b/engines/simon/midi.cpp
index d2d31c1e44..f139f1fa2e 100644
--- a/engines/simon/midi.cpp
+++ b/engines/simon/midi.cpp
@@ -479,14 +479,14 @@ void MidiPlayer::loadMultipleSMF(Common::File *in, bool sfx) {
printf("Expected MThd but found '%c%c%c%c' instead!\n", buf[0], buf[1], buf[2], buf[3]);
return;
}
- in->seek(in->readUint32BE() + in->pos(), SEEK_SET);
+ in->seek(in->readUint32BE(), SEEK_CUR);
// Now skip all the MTrk blocks
while (true) {
in->read(buf, 4);
if (memcmp(buf, "MTrk", 4))
break;
- in->seek(in->readUint32BE() + in->pos(), SEEK_SET);
+ in->seek(in->readUint32BE(), SEEK_CUR);
}
uint32 pos2 = in->pos() - 4;