MuseScore saves a corrupted file after importing a MusicXML file

• Oct 17, 2018 - 09:44
Reported version
3.0
Priority
P2 - Medium
Type
Functional
Severity
S3 - Major
Status
closed
Regression
No
Workaround
No
Project

Steps to reproduce:
1. Open this score: Schubert Messe 1-Kyrie orchestre-transpose.xml
2. MuseScore will complain that the format is wrong, load the file anyway and tell MuseScore ignore errors. MuseScore will load the file and even show something mostly reasonable.
3. Save the score.
4. Try to open the saved file.
Expected results: MuseScore opens the file and shows something similar to what has been loaded on xml import.
Actual results: MuseScore displays "bad format" warning and refuses to load the file.

Investigation of the file produced by MuseScore (attached below) shows that XML tags are not properly closed in the file and the file somehow ends with two </Measure> tags.

Tested on
OS: Debian GNU/Linux 9 (stretch), Arch.: x86_64, MuseScore version (64-bit): 3.0.0, revision: 37b84c0


Comments

Debug output shows "MuseScore/libmscore/utils.cpp:Ms::Score::tick2segment: no segment for tick -76049", which suggests the issue might be caused by a numerical overflow somewhere.

The MusicXML import in itself does not produce any obvious possibly fatal errors.

In reply to by Leon Vinken

There is indeed an overflow, additional logging shows:
mscore/importmxmlpass2.cpp:Ms::MusicXMLParserPass2::measure: time 237/4 mTime 19181/26880
mscore/importmxmlpass2.cpp:Ms::MusicXMLParserDirection::direction: direction tick -44652
mscore/importmxmllogger.cpp:Ms::log: Error at line 3745 col 32: invalid tick -44652
The sum of 237/4 and 19181/26880 leads to an invalid tick value.