Codebase list libsdl2-mixer / 669afa8 debian / patches / fix-750706-upstream-8ef083375857.patch
669afa8

Tree @669afa8 (Download .tar.gz)

fix-750706-upstream-8ef083375857.patch @669afa8raw · history · blame

# HG changeset patch
# User Sam Lantinga <slouken@libsdl.org>
# Date 1383514401 28800
# Node ID 8ef0833758572b84317ba19cc5a1eb2719552da3
# Parent  c166c70fc52a33324945156318ad7454a366eb30
Fixed bug 2140 - Track is played back with the wrong tempo

ny00

It seems like the test against MAXCHAN can safely be relocated after the check if (meep->event.type==ME_TEMPO), with no risk of memory corruption, at least in this function.

diff -r c166c70fc52a -r 8ef083375857 timidity/readmidi.c
--- a/timidity/readmidi.c	Sun Nov 03 11:31:19 2013 -0800
+++ b/timidity/readmidi.c	Sun Nov 03 13:33:21 2013 -0800
@@ -673,15 +673,15 @@
 		meep->event.time, meep->event.channel + 1,
 		meep->event.type, meep->event.a, meep->event.b);
 
-      if (meep->event.channel >= MAXCHAN)
-	skip_this_event=1;
-      else if (meep->event.type==ME_TEMPO)
+      if (meep->event.type==ME_TEMPO)
 	{
 	  tempo=
 	    meep->event.channel + meep->event.b * 256 + meep->event.a * 65536;
 	  compute_sample_increment(tempo, divisions);
 	  skip_this_event=1;
 	}
+      else if (meep->event.channel >= MAXCHAN)
+	skip_this_event=1;
       else if ((quietchannels & (1<<meep->event.channel)))
 	skip_this_event=1;
       else switch (meep->event.type)