Can't open an mscz file (file corruption?)

• Dec 31, 2020 - 18:12

Whenever I open the attached mscz file(1), Musescore crashes and the problem report are shown(2)
Looks like the app encounters segmentation fault while reading the score. However, the others are fine.
I guess the mscz file has some corruption, but I have no idea to find and resolve it.
Thanks in advance.

(1) please see the attached file : attempt_to_open.txt
(2) please see the attached file: problem_report.txt

*Here's the version I use:
MuseScore Version: (
OS Version: Mac OS X 10.15.7 (19H15)

*This is a part of the problem report when the crash occurred:
Crashed Thread: 0 Dispatch queue:

Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000121

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [1361]


Someone that can open it in a debug build will be able to find the line in the score that causes the crash. There are over 58,000 lines so I have no idea which one has the error.

In reply to by mike320

Thanks for the reply. I'm trying to detect which measure causes the crash, moved roughly 2/3 of the measure elements to temporary text file, then an attempt to create a PDF from the mscx file has ended successfully.
$ wc -l
58195 Symphony_No9__From_The_New_World__4th_movement.mscx <- the full version
19938 Symphony_No9__From_The_New_World__4th_movement_debug.mscx <- 1/3 measure elements of the full
38262 ../mscx_temp.txt <- the rest measure elements

Fortunately I found which measures cause the error, measure 307 and 308 on the treble clef. What I had done on the measures was swapping notes with keyboard shortcut.
Removed the bar 307 308 and added rest measures in the mscx file by a text editor, vim.
Investigating the measures one by one was really tough, but I’m glad to recover it, no need to write the score again.

Confirmed, in the latest 3.x development build, stack trace:
1 Ms::ChordRest::up chordrest.h 108 0x1030a1c
2 Ms::Chord::minAbsStemLength chord.cpp 1480 0x92362f
3 Ms::Chord::defaultStemLength chord.cpp 1432 0x9231e4
4 Ms::Chord::layoutStem1 chord.cpp 1516 0x9239b2
5 Ms::Score::getNextMeasure layout.cpp 2982 0x9d49e2
6 Ms::Score::collectSystem layout.cpp 3913 0x9da1d1
7 Ms::LayoutContext::collectPage layout.cpp 4721 0x9dfa09
8 Ms::LayoutContext::layout layout.cpp 5039 0x9e16c6
9 Ms::Score::doLayoutRange layout.cpp 5027 0x9e1624
10 Ms::Score::update cmd.cpp 302 0x52f4be
11 Ms::Score::update score.h 756 0xeff42a
12 Ms::readScore file.cpp 2363 0x4c86d6
13 Ms::MuseScore::readScore file.cpp 455 0x4b920a
14 Ms::MuseScore::openScore file.cpp 413 0x4b8e10
15 Ms::MuseScore::doLoadFiles file.cpp 346 0x4b85e0
16 Ms::MuseScore::openFiles file.cpp 311 0x4b824e
17 Ms::MuseScore::cmd musescore.cpp 6272 0x4307df
18 Ms::MuseScore::cmd musescore.cpp 6064 0x42f6f9
19 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 523 0x5e3e88
20 QMetaObject::activate(QObject *, int, int, void * *) 0x68a947f8

Apparently when trying to access a non-existing 2nd chord of a two-notes tremolo.
I found 2 of those, the last notes in top staff, measures 307 (see below)
and 308, fixed score (with those 2 tremolos removed) attached

Your score had been last saved with MuseScore 3.5.0, update to 3.5.2, even if that does not fix this crash!

Edit: I see just now that you found out about zthe culrpt measures yourself meanwhile

In reply to by Jojo-Schmitz

Code change to prevent the crash:

diff --git a/libmscore/chord.cpp b/libmscore/chord.cpp
index 6bcd8f112..0a4a7e5e4 100644
--- a/libmscore/chord.cpp
+++ b/libmscore/chord.cpp
@@ -1477,7 +1477,7 @@ qreal Chord::minAbsStemLength() const
       // two-note tremolo
       else {
-            if (_tremolo->chord1()->up() == _tremolo->chord2()->up()) {
+            if (_tremolo->chord2() && _tremolo->chord1()->up() == _tremolo->chord2()->up()) {
                   const qreal tremoloMinHeight = _tremolo->minHeight() * spatium();
                   return tremoloMinHeight + beamLvl * beamDist + 2 * td * spatium();


In reply to by Jojo-Schmitz

Thank you so much for the confirmation, I have no idea even if reading the stack trace...
You’re right, when I had saved on 3.5.0 and uploaded it by save online function, I saw a message like this, “ The score cannot be uploaded, as we don't support this version of mscz files yet.” on the page. So I tried to update to 3.5.2, but the crash occurred while opening the mscz file.

In reply to by Jojo-Schmitz

Okay, it happened again when I created a new sample score (attached file: 315002_7201.mscz) and redo the procedure.
Step1: Write two notes that I want to be tremolo.
Step2: Make them 2 notes tremolo.
Step3: However, change the mind, the tremolo should start from higher notes if playing the piano with right hands maybe, enter input mode.
Step4: Swap the two notes using shift + arrows, then close the mscz file. (see : )
Step5: Reopen the saved mscz file by double clicking, Musescore main window disappears immediately.
Step6: The problem report window shows up.

Attachment Size
315002_7201.mscz 7.58 KB

Do you still have an unanswered question? Please log in first to post your question.