# HG changeset patch # User John Tsiombikas # Date 1655417544 -10800 # Node ID abfe7b19079a2e8f42f16103ae55f0f6a0abd853 # Parent 3658e56b3a8aecb3ea877f65df448a7aabc0630e leftover changes from 10 years ago diff -r 3658e56b3a8a -r abfe7b19079a src/midi.c --- a/src/midi.c Thu Jan 26 00:31:39 2012 +0200 +++ b/src/midi.c Fri Jun 17 01:12:24 2022 +0300 @@ -137,7 +137,7 @@ } midi->num_tracks = 0; - while((chunk = skip_chunk(chunk))) { + while((chunk = skip_chunk(chunk)) && ((char*)chunk < mem + size)) { if(ischunk(chunk, "MTrk")) { if(read_track(midi, chunk) == -1) { fprintf(stderr, "failed to read track\n"); @@ -232,6 +232,7 @@ /* if we did actually add any events ... */ if(trk.num_ev) { midi->tracks[midi->num_tracks++] = trk; + printf("loaded track with %d events\n", midi->num_tracks); } return 0; }