mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
72.36k stars 6.59k forks source link

Date might cause infinite loop #1060

Closed jackycute closed 4 years ago

jackycute commented 5 years ago

Describe the bug We found mermaid might fall into a infinite loop when the syntax contains some kind of date.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://mermaidjs.github.io/mermaid-live-editor
  2. Paste below example:
gantt
    excludes weekdays 2017-01-10
    title Projects Timeline

section asdf
     specs :done, :ps, 2019-05-10, 50d
    Plasma      :pc, 2019-06-20, 60d
     Rollup  :or, 2019-08-20, 50d

section CEL

    plasma-chamber      :done, :pc, 2019-05-20, 60d
    Plasma Implementation (Rust)      :por, 2019-06-20, 120d
    Predicates (Atomic Swap)      :pred, 2019-07-20, 60d

section DEX 💰

    History zkSNARK  :hs, 2019-08-10, 40d
    Exit           :vs, after hs, 60d
    PredicateSpec          :ps, 2019-09-1, 20d
    PlasmaIntegration     :pi, after ps,40d

section Events 🏁

ETHBoston :done, :eb, 2019-09-08, 3d
DevCon :active, :dc, 2019-10-08, 3d

section Plasma Calls & updates ✨
    OVM      :ovm, 2019-07-12, 120d
Plasma call 26 :pc26, 2019-08-21, 1d
Plasma call 27 :pc27, 2019-09-03, 1d
Plasma call 28 :pc28, 2019-09-17, 1d 
  1. the page freeze

Expected behavior Should render the diagram or showing some error instead of freezing the page.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

Refer from: https://github.com/hackmdio/hackmd-io-issues/issues/106

sdankel commented 4 years ago

This repros on chromium based browsers (I tried Chrome and Brave), but does not repro on Safari. Still investigating...

sdankel commented 4 years ago

@knsv Ready for review!