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

test: add error case: 'the previous segment must be M/L/C' #204

Merged
merged 1 commit into from
Feb 8, 2023
Merged

Conversation

yisibl
Copy link
Member

@yisibl yisibl commented Feb 8, 2023

This is a normal error thrown by resvg when parsing Path Command and has been confirmed as fixed in resvg 0.30.0(see commit).


Some special svg paths can raise errors, add a test to ensure it is now fixed.

thread '<unnamed>' panicked at 'the previous segment must be M/L/C'

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

Test svg

<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Google News</title><path d="M21.267 21.2a.614.614 0 0 1-.613.613H3.344a.614.614 0 0 1-.612-.613V8.115a.614.614 0 0 1 .613-.613h17.309a.614.614 0 0 1 .613.613V21.2zm-3.032-3.42v-1.195a.08.08 0 0 0-.08-.08h-5.373v1.361h5.373a.082.082 0 0 0 .08-.083v-.003zm.817-2.587v-1.201a.08.08 0 0 0-.079-.082h-6.19v1.362h6.189a.079.079 0 0 0 .08-.078v-.004.003zm-.817-2.588V11.4a.08.08 0 0 0-.08-.08h-5.373v1.361h5.373a.082.082 0 0 0 .08-.079v.004zM8.15 14.045v1.226h1.77c-.145.748-.804 1.292-1.77 1.292a1.976 1.976 0 0 1 0-3.95 1.77 1.77 0 0 1 1.253.49l.934-.932a3.14 3.14 0 0 0-2.187-.853 3.268 3.268 0 1 0 0 6.537c1.89 0 3.133-1.328 3.133-3.197a3.941 3.941 0 0 0-.052-.619l-3.08.006zM2.27 7.654a.616.616 0 0 1 .613-.613h12.154l-1.269-3.49a.595.595 0 0 0-.743-.383L.368 7.775a.594.594 0 0 0-.323.775l2.225 6.112V7.654za.616.616 0 0 1 .613-.613h12.154l-1.269-3.49a.595.595 0 0 0-.743-.383L.368 7.775a.594.594 0 0 0-.323.775l2.225 6.112V7.654zm21.312-.31l-8.803-2.37.751 2.067h5.584a.614.614 0 0 1 .613.613v8.794l2.247-8.366a.592.592 0 0 0-.392-.739zm-4.496-1.675V2.795a.61.61 0 0 0-.611-.608H5.524a.61.61 0 0 0-.616.605v2.837l8.39-3.052a.594.594 0 0 1 .743.39l.544 1.497 4.501 1.205z"/></svg>

@vercel
Copy link

vercel bot commented Feb 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
resvg-js ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 8, 2023 at 1:46PM (UTC)

@yisibl yisibl changed the title test: add more test case test: add error case: 'the previous segment must be M/L/C' Feb 8, 2023
Some special svg paths can raise errors, add a test to ensure it is now fixed..

```
thread '<unnamed>' panicked at 'the previous segment must be M/L/C'

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
```
@yisibl
Copy link
Member Author

yisibl commented Feb 8, 2023

@RazrFalcon
Copy link

No, kurbo shouldn't affect this. Will take a look.

@RazrFalcon
Copy link

I cannot reproduce the panic even on older resvg. Can you clarify how did you able to trigger it?

@yisibl
Copy link
Member Author

yisibl commented Feb 8, 2023

Wait, I'll submit a test case for resvg.

Test case: linebender/resvg#577

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.

2 participants