[Scummvm-cvs-logs] SF.net SVN: scummvm: [21853] scummvm/trunk/sound/midiparser_smf.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Apr 13 16:15:01 CEST 2006


Revision: 21853
Author:   lordhoto
Date:     2006-04-13 16:13:56 -0700 (Thu, 13 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21853&view=rev

Log Message:
-----------
Fixes possible illegal writes/segfaults in compressToType0 (added a comment about the changes).

Modified Paths:
--------------
    scummvm/trunk/sound/midiparser_smf.cpp
Modified: scummvm/trunk/sound/midiparser_smf.cpp
===================================================================
--- scummvm/trunk/sound/midiparser_smf.cpp	2006-04-13 22:47:22 UTC (rev 21852)
+++ scummvm/trunk/sound/midiparser_smf.cpp	2006-04-13 23:13:56 UTC (rev 21853)
@@ -238,9 +238,15 @@
 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;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list