-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mermaid hangs up current page on large inputs #1216
Comments
That was a seriously large diagram. Thanks for reporting this. Even if the diagram is to large it should not hand the page, better to refuse stating that the diagram is to large or similar. |
Been looking at this one and it turns out that the parser is ok. I first thought that was the critical point but instead it was generating that large amount of nodes in the DOM when rendering the svg. I see two ways of handling this. Either I limit the diagram on the text size or by the number of generated DOM elements. The size method is more generic and can be done for all diagrams before the parsing is initiated. The other way is to make sure all diagrams keep track of the number of elements in the diagrams, this has to be done specificly for each diagram type. I lean towards the size method as this one will be easier to maintain and more future proof. There will be a default max size and possibility to override that for when configuring mermaid by an integrator. |
This fix will be included in 8.4.7 |
#1216 Fix for issue when mermaid freezes the browser tab due to large…
Overview
When we send in large input to Mermaid for rendering, mermaid hangs up the entire page which results in page being unresponsive.
Implications can be huge when a website saves the mermaid code and displays it to different users. This can cause a denial of service attack.
Problematic scenario
mermaid.txt
To Reproduce
Steps to reproduce the behavior:
Load sample diagram
textarea.Expected behavior
Mermaid render should not hang up the page, it should either stop rendering when it determines that the input is too large or don't start the render at all.
Screenshots
See "To Reproduce" section.
Desktop (please complete the following information):
Applicable to all desktops
Smartphone (please complete the following information):
Applicable to all mobiles
The text was updated successfully, but these errors were encountered: