MusicXML import causes corruption, attempts to fix causes crash

• Sep 16, 2018 - 10:54
Reported version
2.3
Priority
P1 - High
Type
Functional
Severity
S1 - Blocker
Reproducibility
Always
Status
fixed
Regression
No
Workaround
No
Project
Priority (old)
critical
Status (old)
active
Component (old)
Code
Category (old)
bug report

MuseScore 2.3.2 on Windows 7

Came up in http://notensatz.forumprofi.de/index.php?topic=1882.0

Opening the attached MusicXML file (taken from http://www1.cpdl.org/wiki/index.php/Psalm_23_%28Franz_Schubert%29) reports

Measure 20 Staff 3 incomplete. Expected: 4/4; Found: 1918/1920
Measure 63 Staff 3 incomplete. Expected: 4/4; Found: 1918/1920

Swapping voice 1 and 2 twice doesn't fix it.
Attempts to delete those measure causes a crash

Saving as mscz and reopening additionally complains about similar corruptions in measure 28-55, staff 3 and 4

The file seems to stem from a direct (i.e. non-Dolet) Sibelius 7.5.1 export. And the problem seems to be related to tuplets.

Current master crashes directly on opening the file.

Attachment Size
Ws-schb-p23.mxl 45.71 KB

Comments

In reply to by Leon Vinken

Please ignore previous comment.

Current master still crashes ... Spent some time debugging about four weeks ago. Cause of the crash is that one of the notes used in tuplet layout is in a measure with _parent set to nullptr. Unfortunately, I have been unable to find the cause and solution for this.

Here is a reduced version of the file isolating the problematic measures (i.e. measures 30 and 31 of part P3), where I deleted some additional notations (e.g. the tremolos).
From what I can see, a tuplet of 7 elements (??) is created with some elements belonging to one measure and some elements belonging to another measure.
The "tuplet" notation "starts" and "stops" are messed up, but I don't think they are taken into account when reconstructing the actual tuplets in the MusicXml importer.
Attached also the result of import in Finale Notepad 2012.
[ Additional note: if I delete the whole "print" tag of measure 2 I obtain a crash on assert "!empty()" in libmscore/stafftypelist.cpp line 44. ]

Attachment Size
reduced_sample.xml 24.61 KB
reduced_sample_Finale.pdf 19.83 KB

Thanks for isolating the offending MusicMXL snippet, I had no clue where to start looking. Your abbreviated file still crashes with the same stack trace (that helps). Indeed the crash seems tuplet related, as the console shows "importmxmlpass2.cpp:Ms::addTupletToChord: tuplet already started" errors. Will have a try at finding the cause again.

In reply to by Leon Vinken

It looks like the cause of the crash is the MusicXML importer creating tuplets crossing measure boundaries. I believe this is not supported by MuseScore.

When I prevent this, file Ws-schb-p23.mxl imports correctly and no further ill effects are created. Currently I only have a crude and experimental fix implemented, but I will clean this up and provide a PR shortly.