Skip to content

Fix an assert when trimming utf8 strings - #287

Open
kryksyh wants to merge 1 commit into
musescore:mainfrom
kryksyh:fix_crash
Open

kryksyh wants to merge 1 commit into
musescore:mainfrom
kryksyh:fix_crash

Conversation

@kryksyh

@kryksyh kryksyh commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

If a string contains unicode characters with value >= 0x80, it become negative int ch, calling std::isspace with negative argument causes an assert.

Resolves: an assert in audacity during opening VST view if it contains unicode characters

  • I signed the CLA as username:
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves. If changes are extensive, there is a sequence of easily reviewable commits.
  • The code in the PR follows the coding rules.
  • I understand all aspects of the code I'm contributing and I'm able to explain it if requested.
  • The code compiles and runs on my machine, preferably after each commit individually. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist, or if they do, I listed them in my PR description and described how I avoided repeating past mistakes.
  • There are no unnecessary changes.
  • I created a unit test or vtest to verify the changes I made (if applicable).

Build configuration

audacity: audacity/audacity/master
audacity platforms: linux_x64
musescore: musescore/MuseScore/main
musescore platforms: linux_x64

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: d69c810b-6649-4b4b-8a09-4bb5c3dc2f05

📥 Commits

Reviewing files that changed from the base of the PR and between 6798dda and ddbee96.

📒 Files selected for processing (1)
  • framework/global/stringutils.cpp

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

muse::strings::ltrim and rtrim now use find_first_not_of and find_last_not_of with the fixed ASCII whitespace set " \t\n\v\f\r". The previous locale-dependent std::isspace checks were removed.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to ddbee

Trimming now handles UTF-8 text without asserting on non-ASCII bytes while preserving ASCII whitespace trimming. No concrete merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the primary change: fixing an assertion during UTF-8 string trimming.
Description check ✅ Passed The description explains the assertion cause, affected scenario, motivation, checklist status, and build configuration. The Resolves: line does not contain a valid issue number or direct issue link,…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants