MIDI import on certain MIDIs crash MuseScore

• Nov 10, 2013 - 15:46
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Importing the MIDI attached crashes the program. I'm not sure what exactly does it.
To Reproduce:
1. Click Open
2. Open the attached file
Expected:
Imports the file.
Actual:
The application has requested to terminate in an unusual way.

Attachment Size
1+sum(not(cumSum(N=L₁.mid 319.8 KB

Comments

During my first investigation, I found that the tick value calculated from the ReducedFraction via ticks() function returns a negative value due to the int overflow.

Input fraction:
_numerator = 1 118 639
_denominator = 1 920
fraction.ticks() = (_numerator * MScore::division * 4 + (_denominator/2)) / _denominator;
MScore::division = 480,

so 1 118 639 * 480 * 4 is already 2 147 786 880,
that is greater than the 32 bit signed int limit: 2 147 483 648.

Debugger shows the answer: ticks() = -1 118 322

TimeSigMap::tickValues() calls abort() when a time moment was not found (because tick value is negative).