Commit 0fa80fd
Fix panic in feComposite arithmetic with oversized filter region
The source pixmap of a filtered group is clamped to `max_bbox` in
`render_group`, but the filter `region` in `apply_inner` was derived
directly from the unclamped filter rect. When the filter region was
larger than the clamped buffer, `feComposite` with the `arithmetic`
operator panicked on a size mismatch, since it requires its inputs and
destination to have identical dimensions:
assertion failed: src1.height == src2.height && src1.height == dest.height
All intermediate filter images are expected to share the source's
dimensions, so clamp the region to the source bounds. This keeps every
buffer the same size and makes the affected SVG render correctly instead
of crashing (or being silently cleared).
This also fixes the `huge-region` test, whose reference image previously
captured the buggy behaviour where the filtered element disappeared; it
now renders the blurred shape correctly.
Fixes #1021. Fixes #1007.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent fd5eab9 commit 0fa80fd
6 files changed
Lines changed: 27 additions & 0 deletions
File tree
- crates/resvg
- src/filter
- tests
- integration
- tests/filters
- feComposite
- filter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
368 | 378 | | |
369 | 379 | | |
370 | 380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
Lines changed: 13 additions & 0 deletions
Loading
0 commit comments