Skip to content

[Bug]: nested duplicated clipPath causes infinite recursion #10659

@Disperito

Description

@Disperito

CheckList

  • I agree to follow this project's Code of Conduct
  • I have read and followed the Contributing Guide
  • I have read and followed the Issue Tracker Guide
  • I have searched and referenced existing issues and discussions
  • I am filing a BUG report.
  • I have managed to reproduce the bug after upgrading to the latest version
  • I have created an accurate and minimal reproduction

Version

6.7.0

In What environments are you experiencing the problem?

Chrome

Node Version (if applicable)

None

Link To Reproduction

https://codesandbox.io/p/devbox/fabric-vanillajs-sandbox-forked-hnqz4y

Steps To Reproduce

  1. Open the reproduction
  2. Click the "Load Good SVG" button, the SVG will be loaded smoothly
  3. Click the "Load BAD SVG" button, the page will get stuck (you can see the animation stop) and crash after a while

Expected Behavior

The "BAD SVG" can also be loaded successfully.

Actual Behavior

The infinite recursion inside fabric.js cause the web page crashed.

Error Message & Stack Trace

No logs will produces, but the calling stack is:
loadSVGFromString -> parseSVGDocument-> ElementsParser#parse -> ElementsParser#createObject -> ElementsParser#resolveClipPath -> ElementsParser#resolveClipPath -> ElementsParser#resolveClipPath -> ElementsParser#resolveClipPath ...
Then stuck in infinite recursion.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions