Segmentation Fault when opening a file with a missing section break element
Reported version
3.3
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project
OS: Debian GNU/Linux bullseye/sid, Arch.: x86_64, MuseScore version (64-bit): 3.6.1.515740129, revision: d0fc8e9
Whenever I try to open this file (joined), I get a segmentation fault.
This file seems to be valid though:
<?xml version="1.0" encoding="UTF-8"?>
"No carrier"ersion="3.01">
3.2.3
d2d863f
0
480
8.27008
11.6902
7.08898
0.787402
0.393701
0.393701
0.393701
0.393701
0.590551
6
6
6
12
1
12
1
9
4
0.46
0.65
1
0.64
1.75
1.2
1
0
0
0
0
0.5
0
0
0
0
0
1
1
0
0
0
2
0
0
0
0
0
0
left,baseline
0
0
25
0
0
25
etc.
Attachment | Size |
---|---|
Frescobaldi_-_Canzon_1.mscx | 1.28 MB |
Fix version
3.6.2
Comments
Well, the "No Carrier" is generated by the launch of the Appimage in a terminal...
I just read Marc's comment saying a crash is critical ;-)
Regression vs what?
3.5.2 crashes on it too
3.3.4 too
stack trave i(in lares 3.x development code):
1 Ms::LayoutBreak::firstSystemIdentation layoutbreak.h 73 0x10245dc
2 Ms::Score::collectSystem layout.cpp 4077 0x9df74c
3 Ms::LayoutContext::collectPage layout.cpp 4724 0x9e42dd
4 Ms::LayoutContext::layout layout.cpp 5042 0x9e5f9c
5 Ms::Score::doLayoutRange layout.cpp 5030 0x9e5efa
6 Ms::Score::update cmd.cpp 302 0x53023e
7 Ms::Score::update score.h 756 0xf04c2a
8 Ms::readScore file.cpp 2382 0x4c9004
9 Ms::MuseScore::readScore file.cpp 473 0x4b9adc
10 Ms::MuseScore::openScore file.cpp 415 0x4b959e
11 Ms::MuseScore::doLoadFiles file.cpp 348 0x4b8ce8
12 Ms::MuseScore::openFiles file.cpp 313 0x4b892e
13 Ms::MuseScore::cmd musescore.cpp 6241 0x4303dd
14 Ms::MuseScore::cmd musescore.cpp 6033 0x42f2f7
15 Ms::MuseScore::qt_static_metacall moc_musescore.cpp 523 0x5e4d4a
16 QMetaObject::activate(QObject *, int, int, void * *) 0x68a947f8
17 QActionGroup::hovered(QAction *) 0x2cdc4db2
18 QActionGroup::qt_static_metacall(QObject *, QMetaObject::Call, int, void * *) 0x2cdc573c
19 QMetaObject::activate(QObject *, int, int, void * *) 0x68a947f8
20 QAction::activate(QAction::ActionEvent) 0x2cdc3e0e
...
The code where it crashes now didn't exist prior to 3.6, yet it crashed there too.
The score has 3 section breaks, removing those and it loads
At the point where the crash occurs, it seems the measure in question (105) is flagged as containing a section break, and yet, when we go to find it, we find it isn't there, instead there are two page breaks. So any code that tries to get the section break element is going to get confused and possibly crash, not just this new bit of code.
Now, this doesn't seem to reflect what's actually in the file. I guess this must be 105 in Canzon 4. Something apparently goes wrong and turns the section break into a second page break sometime before this crash happens. No idea where or why, though. It does load in 3.0.0 so technically a regression, but not a recent one apparently. And no idea what the trigger is, as normally it's fine to combine page and section breaks.
The problem is with the 14-bar multimeasure rest in Canzon 3. There is a section break on the last of its underlying measures, but there is no section break element on the multimeasure rest itself. This can be fixed by opening the MSCX file in a text editor, navigating to line 9276, and replacing
<subtype>line</subtype>
with<subtype>section</subtype>
.I have found that I can create this situation from scratch.
Wow! How efficient you are! Thank you all for the solution to reopen my score.
I hope this won't be too much work to fix this strange behavior.
Overriding
Element::subtype()
in theLayoutBreak
class is enough to prevent this situation from happening in the future.The
subtype()
function is used here to find elements from a previous incarnation of the MMRest that can be reused. SinceElement::subtype()
simply returns-1
, a LayoutBreak of type LINE was considered a match for a LayoutBreak of type SECTION, which is what caused the problem in the first place.I didn't realize this at the time, but overriding
Element::subtype()
in theLayoutBreak
class will cause the original problematic score to be corrected upon load, completely taking care of the problem without having to introduce additional checks for whether the section break element actually exists. See https://github.com/musescore/MuseScore/pull/7407.Fixed in branch 3.x, commit 5802c49234
_Fix #316679: Segmentation Fault when opening a file with a missing section break element
Resolves: https://musescore.org/en/node/316679.
The LayoutBreak class failed to override Element::subtype(), causing a LayoutBreak of type LINE to be considered a match for a LayoutBreak of type SECTION when determining which elements to reuse from a previous incarnation of an MMRest._
Fixed in branch master, commit 7a75f0e2d3
_Fix #316679: Segmentation Fault when opening a file with a missing section break element
Resolves: https://musescore.org/en/node/316679.
The LayoutBreak class failed to override Element::subtype(), causing a LayoutBreak of type LINE to be considered a match for a LayoutBreak of type SECTION when determining which elements to reuse from a previous incarnation of an MMRest._
Automatically closed -- issue fixed for 2 weeks with no activity.