Skip to content

Show desktop reader code blocks as plain text when highlighting overflows the regex stack - #1633

Closed
prof18 wants to merge 1 commit into
mainfrom
fix/bug-desktop-code-highlight-overflow
Closed

prof18 wants to merge 1 commit into
mainfrom
fix/bug-desktop-code-highlight-overflow

Conversation

@prof18

@prof18 prof18 commented Nov 6, 2026

Copy link
Copy Markdown
Owner

The desktop reader crashed with a StackOverflowError (Sentry JAVA-N1/JAVA-N2, 1.19.0) when an article had a code block with a long string literal: Jewel's default SimpleCodeHighlighter matches literals with patterns like "(?:[^"\]|\.)*", which java.util.regex runs recursively once per character, and Jewel rethrows the error in the composition. The reader now passes its own highlighter that wraps SimpleCodeHighlighter and falls back to the plain code when it overflows. A Compose test that renders a fenced JSON block with a 200k-character string reproduced the crash and now passes, and the full detekt allTests gate is green.

@prof18

prof18 commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Closing as a duplicate of #1632, which has the same fix for JAVA-N1/JAVA-N2 plus a test that reproduces the overflow in Jewel's highlighter and a Compose test that fails without the fix.

@prof18 prof18 closed this Nov 6, 2026
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.

1 participant