FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix ArrayIndexOutOfBoundsException with compact SVG arc notation by hxrshxz · Pull Request #1282 · processing/processing4 · GitHub

Fix ArrayIndexOutOfBoundsException with compact SVG arc notation - #1282

Merged
catilac merged 4 commits into
processing:mainfrom
hxrshxz:svg
Feb 5, 2026
Merged

Fix ArrayIndexOutOfBoundsException with compact SVG arc notation#1282
catilac merged 4 commits into
processing:mainfrom
hxrshxz:svg

Conversation

hxrshxz commented Oct 14, 2025

Copy link
Copy Markdown
Contributor

Fixes #1244

Summary

Adds support for compact SVG arc notation where flags and coordinates are concatenated (e.g., a2 2 0 013 3 instead of a 2 2 0 0 1 3 3). Previously crashed with ArrayIndexOutOfBoundsException.

Changes

  • core/src/processing/core/PShapeSVG.java: Added isCompactArcNotation() helper method to detect and parse concatenated arc flags/coordinates for both A and a commands
  • core/test/processing/core/PShapeSVGPathTest.java: Added 4 test cases covering compact notation, standard notation, and edge cases

Before

Screencast.from.2025-10-15.00-31-18.mp4

After

Screencast.from.2025-10-14.23-14-15.mp4

Copilot AI review requested due to automatic review settings October 14, 2025 19:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull Request Overview

This PR fixes an ArrayIndexOutOfBoundsException that occurred when parsing SVG arc commands with compact notation where flags and coordinates are concatenated (e.g., a2 2 0 013 3). The fix adds support for detecting and properly parsing this compact format.

Key changes:

  • Added isCompactArcNotation() helper method to detect concatenated arc flags and coordinates
  • Modified arc parsing logic for both absolute (A) and relative (a) commands to handle compact notation
  • Added comprehensive test coverage for various compact arc notation scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
core/src/processing/core/PShapeSVG.java Implements compact arc notation detection and parsing logic
core/test/processing/core/PShapeSVGPathTest.java Adds test cases for compact notation, standard notation, and edge cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

hxrshxz commented Oct 14, 2025

Copy link
Copy Markdown
Contributor Author

@catilac have a look :)

Copy link
Copy Markdown
Member

Hi @hxrshxz great work! Thank you!

Looking at the tests, the one thing I would say to be missing is a step that actually checks if the parsing occurred correctly by looking at the numbers that the parser spits out, I would say just checking if the shape parses is not enough.

hxrshxz commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

Thanks @Stefterv I have added tests to verify the actual parsed endpoint values, not just that the shape doesn't crash

catilac requested a review from Stefterv October 22, 2025 02:49

catilac left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good! I have some questions. Sorry to take so long with this.

Comment thread core/src/processing/core/PShapeSVG.java Outdated

hxrshxz commented Dec 16, 2025

Copy link
Copy Markdown
Contributor Author

really sorry for taking so long

hxrshxz requested a review from catilac December 16, 2025 19:20
hxrshxz closed this Dec 27, 2025
hxrshxz reopened this Dec 27, 2025

catilac commented Jan 13, 2026

Copy link
Copy Markdown
Collaborator

@hxrshxz this is approved! yay. we are going to do some additional hand testing before it gets merged in. we have an upcoming 4.5 release so i'm being extra careful. but thank you so much! sorry to take so long in accepting this.

catilac merged commit afd1d98 into processing:main Feb 5, 2026
6 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Loading SVG fails for some files

4 participants


Back | FazBrowse Home | New Git URL