Crash when repeatedly pressing Shift+A

• Sep 30, 2015 - 11:27
S2 - Critical

This bug report came in via email.

Steps to reproduce in 2.0.2:

* Start with a blank score, e.g. just choose Treble clef template.
* Type letter a; an a crochet/quarter note appears.
* Type Shift+A: the A above appears.
* Repeat pressing Shift+A: further octaves of A's appear, but the maximum of note G9 (MIDI note 127) is not respected.

If you continue for too long, MuseScore will crash.

Fix would be to limit to the corrected note range, G9 (MIDI note 127) and disallow adding further notes beyond this range.


Seems Shift+A in mscore/scoreview.cpp, line 2858 ff. calls Score::cmdAddInterval(8, ...) in libmscore/cmd.cpp, line 403 ff. This calls line2pitch() which seems to properly reduce to values between 0 and 127, (libmscore/utils.cpp, line 338 ff.)

no stack trace, it just stops working without any trace but an "...exited with code 3"
So not really a crash but a more or less clean exit with an error code

Fatal: ASSERT: "line >= 0 && line < 75" in file ...\libmscore\key.cpp, line 182 (:0, )

What do you suggest should be done here ? It looks like it is a limitation of MS, that should be handled with some error message rather that a Q_ASSERT.

It should be solved way before the Q_ASSERT. Probably in void ScoreView::cmdAddPitch(int note, bool addFlag) where the computed step should be checked and not be too low or too high.