Skip to content

Commit 27185cd

Browse files
committed
Fix the assertion problem
1 parent 644b5e6 commit 27185cd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/smf_load.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,21 @@ extract_midi_event(const unsigned char *buf, const int buffer_length, smf_event_
503503
return (-1);
504504
}
505505

506-
if (is_sysex_byte(status))
506+
if (is_sysex_byte(status)) {
507+
if (c == buf) {
508+
g_critical("SMF error: running status is not applicable to System Exclusive events.");
509+
return (-2);
510+
}
507511
return (extract_sysex_event(buf, buffer_length, event, len, last_status));
512+
}
508513

509-
if (is_escape_byte(status))
514+
if (is_escape_byte(status)) {
515+
if (c == buf) {
516+
g_critical("SMF error: running status is not applicable to Escape events.");
517+
return (-2);
518+
}
510519
return (extract_escaped_event(buf, buffer_length, event, len, last_status));
520+
}
511521

512522
/* At this point, "c" points to first byte following the status byte. */
513523
message_length = expected_message_length(status, c, buffer_length - (c - buf));

0 commit comments

Comments
 (0)