Skip to content

Invalid XY Chart crashes browser tab (CODE_HUNG error) #7279

@DavidSeptimus

Description

@DavidSeptimus

Description

When I add a multiline accDescr element to my XY Chart, the moment the braces are closed, the browser tab hangs and crashes with a CODE_HUNG error

Steps to reproduce

  1. Copy the code sample into the mermaid.live editor
  2. Tab will crash

Alternatively, remove the trailing } character before pasting, so you can type it yourself to trigger the crash.

Screenshots

Tab hanging immediately after typing closing } (it's not visible because the tab hangs before monaco-editor can render it.

Image

Crashed tab:

Image

Code Sample

xychart
accTitle: Sales Overview
accDescr {}
title "Revenue Report"
y-axis 0 --> 100
line [45, 67,89, 55]
bar [30, 40, 50, 35]
bar [.5, 1.5, +2.0, -0.5]
x-axis ["Q1", "Q2", "Q3", "Q4"]

Setup

  • Mermaid version: v11.12.0
  • Browser and Version: Chrome 143.0.7499.170 (Official Build) (arm64)

Suggested Solutions

This appears to be a parsing bug caused by an incorrect closing token pattern for acc_descr_multiline - matching { instead of } resulting in the parser getting trapped in an infinite loop within the acc_descr_multiline state.

xychart.jison

Additional Context

It doesn't matter if there's text between the braces or if it's spread across multiple lines. Any of those patterns will crash the tab.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageNeeds to be verified, categorized, etcType: Bug / ErrorSomething isn't working or is incorrect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions