Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when opening a specific MusicXML score #26593

Open
4 tasks done
leleogere opened this issue Feb 19, 2025 · 7 comments · May be fixed by #26602 or #26680
Open
4 tasks done

Segmentation fault when opening a specific MusicXML score #26593

leleogere opened this issue Feb 19, 2025 · 7 comments · May be fixed by #26602 or #26680
Assignees
Labels
crash Issues involving a crash of MuseScore MusicXML regression MS4 Regression on a prior release

Comments

@leleogere
Copy link

leleogere commented Feb 19, 2025

Issue type

Crash or freeze

Description with steps to reproduce

Open the attached score in MuseScore, wait for it to crash.

While the engraving quality of this MusicXML can (and should!) be discussed, MuseScore was able to open it up to version 4.1.1 (despite a warning about the score being corrupted). From 4.2, it leads to a segmentation fault.

Supporting files, videos and screenshots

Corrupted file: xml_score.musicxml.zip

Debug logs: https://pastebin.com/8sGPh8VA (too long for github issue)

What is the latest version of MuseScore Studio where this issue is present?

MuseScore Studio version (64-bit): 4.4.4-243461245, revision: github-musescore-musescore-2232670

Regression

Yes, this used to work in a previous version of MuseScore 4.x

Operating system

OS: Pop!_OS 22.04 LTS, Arch.: x86_64

Additional context

No response

Checklist

  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible
@muse-bot muse-bot added crash Issues involving a crash of MuseScore regression MS4 Regression on a prior release labels Feb 19, 2025
@Jojo-Schmitz
Copy link
Contributor

Note: the attached xml_score.musicxml.zip is not a .zip file, but just a renamed .musicxml file

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Feb 19, 2025

Latest development build crashes too, as does 4.3.2 and 4.2.1.
4.1.1 (and 4.0.1) does not (but reports 2 corruptions), same for 3.6.2

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Feb 19, 2025

It crashes here:

const EngravingItem* e = s->element(item->track());

with s being a nullptr
Changing that to

    const EngravingItem* e = s ? s->element(item->track()) : nullptr;

makes it crash a few lines later, at

const Measure* m = s2->measure();

@Jojo-Schmitz
Copy link
Contributor

Seems an early exit is needed if s or s2is a nullptr?

@Jojo-Schmitz
Copy link
Contributor

Maybe not, see PR #26602

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Feb 22, 2025

The score seems to stem from http://musescore.com/score/658031, it says that in the .musicxml. But that score stems from MuseScore 1.3, while your .musicxml stems from 3.4.2 (also says that in the .msucxml)?!?
What happened to that file in between? The original score doesn't cause any issues (neither the .mscz nor the .mxl), except for reporting a couple corruptions (something MuseScore 1.3 wasn't capable of).

The problem seems to be that there are (now!) multiple fermatas (4) attached to (mutlitpe) grace notes. The original didn't have any fermatas at grace notes

cbjeukendrup added a commit to cbjeukendrup/MuseScore that referenced this issue Feb 22, 2025
…rd to segment

Resolves: musescore#26593

If a MusicXML file contains multiple fermatas on one grace note, then those fermatas except the first would not be moved from the grace chord to the segment. This means that there are fermatas with no segment encountered during layout when going through that grace chord's `el()`, which causes a crash.

Inspired by the investigation at musescore#26602.
@leleogere
Copy link
Author

leleogere commented Feb 24, 2025

The score seems to stem from http://musescore.com/score/658031, it says that in the .musicxml. But that score stems from MuseScore 1.3, while your .musicxml stems from 3.4.2 (also says that in the .msucxml)?!?
What happened to that file in between?

That file comes from the ASAP dataset, and I guess the authors probably ran some automatic and/or manual post-processing in an attempt to fixe some errors in the scores, resulting in this weird MusicXML.

This score definitely has issues that must be fixed, I just reported it as it was a regression since version 4.1. Anyway, well done for finding the cause of the crash!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Issues involving a crash of MuseScore MusicXML regression MS4 Regression on a prior release
Projects
Status: In Progress
8 participants