Skip to content
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

Avoid stack overflow when self-referential elemetns present, only use… #218

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

dnfield
Copy link
Owner

@dnfield dnfield commented Oct 11, 2023

… first ID

  • The XML specification says that the id attribute must be unique per document. However, SVGs in the wild don't necessarily do this. Browsers seem to handle this by taking the first instance of an ID and ignoring subsequent ones. This patch changes behavior so that only the first id is used instead of the last one.
  • A use element that tries to use itself doesn't make sense. This patch detects when a use element tries to use itself and ignores that, which prevents a later stack overflow issue.

Fixes dnfield/flutter_svg#997

Copy link
Collaborator

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dnfield dnfield merged commit 6106ede into main Oct 12, 2023
3 checks passed
@dnfield dnfield deleted the so branch October 12, 2023 03:15
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.

Maximum call stack size exceeded with specific SVG file
2 participants