Conversation
|
@ptz0n is attempting to deploy a commit to the yisibl's projects Team on Vercel. A member of the Team first needs to authorize it. |
ptz0n
force-pushed
the
fix/wasm-off-canvas-panic-and-reset
branch
from
September 8, 2026 18:06
1479289 to
9cdf875
Compare
…e canvas Points the resvg patch at a fork carrying linebender/resvg@4a08e340 (closes #638), which this crate's pinned fork missed. Also adds console_error_panic_hook and resetWasm().
ptz0n
force-pushed
the
fix/wasm-off-canvas-panic-and-reset
branch
from
September 8, 2026 18:16
9cdf875 to
a139cd5
Compare
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The wasm build crashes hard on ordinary SVG content: any
<g>with a clip-path/mask/filter/isolated opacity whose content extends off-canvas triggers aRuntimeError: unreachable. That's not a rare shape — a background layer bigger than its viewport, a virtualized list row placed off-screen, anything like that.Root cause is in resvg, not here:
fit_to_rectclamps each rect edge independently and only inward, so a rect entirely past one bound produces an inverted rect that panics on.unwrap()instead of returningNone. RazrFalcon fixed this exact bug upstream in June 2023 (4a08e34, closes #638). The resvg fork this crate pins diverged before that fix landed and never picked it up — the fork's own currentmasterhas since picked it up too via a later, unrelated sync with upstream, but that's 3 major versions and ~40 commits ahead of the specific old commit this crate is actually pinned to, and not semver-compatible with it. So I reapplied the fix directly on top of that old pinned commit: ptz0n/resvg@1759f23. (I'd opened a PR for this against the fork too, but closed it — nothing for itsmasterto merge, sincemasteralready has the fix.)Tested against 660 real, structurally distinct production SVGs, rendered through this crate's own wasm build: 120 crashed before this fix, 0 after. Added a regression test for the minimal case.
Also in this PR:
console_error_panic_hook, wired into theResvgconstructor. Right now any wasm panic just saysunreachable— no message, no location. This is how I actually found the bug above; without it this would've been a lot harder to track down.resetWasm(). wasm32 linear memory only grows, never shrinks. A long-lived host that renders enough structurally varied SVGs can still accumulate memory over time even with correct.free()calls everywhere. This lets a caller discard the instance and start fresh without restarting the whole process.Split into separate PRs if you'd rather review them independently — bundled here since I found and fixed all three while debugging one production issue.