MuseScore saves a corrupted file after importing a MusicXML file
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
Attachment | Size |
---|---|
Schubert Messe 1-Kyrie orchestre-transpose_0.mscx | 2.36 MB |
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 Debug output shows … 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.
Overflow occurs in Fraction::ticks(), can be fixed by using int_least64_t instead of int in the calculation.
Fixed in branch master, commit 915bb6a29c
fix #277230 - MuseScore saves a corrupted file after importing a MusicXML file
Fixed in branch master, commit a4e6ad8260
Merge pull request #4128 from lvinken/277230-musicxml-corruption
fix #277230 - MuseScore saves a corrupted file after importing a Musi…
Automatically closed -- issue fixed for 2 weeks with no activity.