diff options
author | Johannes Schickel | 2006-04-13 23:13:56 +0000 |
---|---|---|
committer | Johannes Schickel | 2006-04-13 23:13:56 +0000 |
commit | fac96dfb34b3f35109394e7a4d41eb2e1c79429e (patch) | |
tree | a8391787e62a426ccbce470f2878c47c4d97c137 | |
parent | 1444a1ab9f82c11d1348b85401d5b2bfd830f89f (diff) | |
download | scummvm-rg350-fac96dfb34b3f35109394e7a4d41eb2e1c79429e.tar.gz scummvm-rg350-fac96dfb34b3f35109394e7a4d41eb2e1c79429e.tar.bz2 scummvm-rg350-fac96dfb34b3f35109394e7a4d41eb2e1c79429e.zip |
Fixes possible illegal writes/segfaults in compressToType0 (added a comment about the changes).
svn-id: r21853
-rw-r--r-- | sound/midiparser_smf.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/midiparser_smf.cpp b/sound/midiparser_smf.cpp index d6235da208..dc810f9178 100644 --- a/sound/midiparser_smf.cpp +++ b/sound/midiparser_smf.cpp @@ -238,9 +238,15 @@ bool MidiParser_SMF::loadMusic(byte *data, uint32 size) { void MidiParser_SMF::compressToType0() { // We assume that _buffer has been allocated // to sufficient size for this operation. - byte *track_pos[16]; - byte running_status[16]; - uint32 track_timer[16]; + + // using 0xFF since it could write track_pos[0 to _num_tracks] here + // this would cause some illegal writes and could lead to segfaults + // (it crashed for some midis for me, they're not used in any game + // scummvm supports though). *Maybe* handle this in another way, + // it's at the moment only to be sure, that nothing goes wrong. + byte *track_pos[0xFF]; + byte running_status[0xFF]; + uint32 track_timer[0xFF]; uint32 delta; int i; |