Skip to content

This SVG causes SVGO to error: TypeError: Cannot read properties of undefined (reading '0') #2095

@futuremotiondev

Description

@futuremotiondev

Describe the bug

Image

When processing the SVG above with SVGO, I get the following error:

TypeError: Cannot read properties of undefined (reading '0')
    at reflectPoint (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\plugins\convertPathData.js:1160:37)
    at C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\plugins\convertPathData.js:802:43
    at Array.filter (<anonymous>)
    at filters (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\plugins\convertPathData.js:397:15)
    at Object.enter (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\plugins\convertPathData.js:183:20)
    at visit (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\xast.js:52:30)
    at visit (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\xast.js:68:9)
    at visit (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\xast.js:61:7)
    at invokePlugins (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\svgo\plugins.js:25:7)
    at Object.fn (C:\Users\futur\AppData\Local\nvm\v23.9.0\node_modules\svgo\lib\svgo\plugins.js:57:7)

To Reproduce
Steps to reproduce the behavior:

  1. Download this svg: FirefoxBW.zip
  2. Try to run SVGO on it. svgo .\FirefoxBW.svg
  3. See error

Expected behavior
I expected SVGO to gracefully recover from malformed input

Desktop (please complete the following information):

  • SVGO Version 3.3.2
  • NodeJs Version 23.9.0
  • OS: Windows 10 Pro x64 22H2 (OS Build 19045.5555)

Additional context

There is another bug report here #1863 that references the same issue, however there was a fix merged: #2054.

I'm not sure if this SVG has the same problem or if it's something else causing SVGO to break.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions