Closed
Description
Unexpected SVG input can cause the program to panic due to this assert:
resvg/crates/resvg/src/filter/lighting.rs
Line 140 in b8e58f5
| assert!(src.width == dest.width && src.height == dest.height); |
I believe this is a bug as a library should not panic depending on user-dependent input data.
Steps to reproduce:
- Install https://flathub.org/en/apps/io.github.davidoc26.wallpaper_selector
- Feed its icon into resvg
Code to reproduce panic (just cargo add resvg + cargo run)
fn main() {
let width = 96;
let height = 96;
let file_path = "/var/lib/flatpak/exports/share/icons/hicolor/scalable/apps/io.github.davidoc26.wallpaper_selector.svg";
let options = resvg::usvg::Options {
style_sheet: Some("svg { color: white }".into()),
..Default::default()
};
let data = std::fs::read(file_path).unwrap();
let tree = resvg::usvg::Tree::from_data(data.as_slice(), &options).unwrap();
let svg_size = tree.size();
let scale_x = (width as f32) / svg_size.width();
let scale_y = (height as f32) / svg_size.height();
let mut pixmap = resvg::tiny_skia::Pixmap::new(width as _, height as _).unwrap();
let transform = resvg::usvg::Transform::from_scale(scale_x, scale_y);
resvg::render(&tree, transform, &mut pixmap.as_mut());
}Reacted by n4n5
Metadata
Metadata
Assignees
Labels
No labels
Activity
galister commentedon Jan 12, 2026
here's the svg file separately, though I'm not sure if github alters it in any way
Fix texture/shine rendering
⬆️ Update Rust crate resvg to 0.48.0
⬆️ Update Rust crate usvg to 0.48.0
⬆️ Update Rust crate resvg to 0.48.1
⬆️ Update Rust crate usvg to 0.48.1
⬆️ Update Rust crate resvg to 0.48.1
⬆️ Update Rust crate usvg to 0.48.1
⬆️ Update Rust crate resvg to 0.48.1
⬆️ Update Rust crate usvg to 0.48.1
⬆️ Update Rust crate resvg to 0.48.1
⬆️ Update Rust crate usvg to 0.48.1
⬆️ Update Rust crate usvg to 0.48.1
⬆️ Update Rust crate resvg to 0.48.1
⬆️ Update Rust crate resvg to 0.48.1
⬆️ Update Rust crate usvg to 0.48.1
⬆️ Update Rust crate resvg to 0.48.1
⬆️ Update Rust crate usvg to 0.48.1
⬆️ Update Rust crate resvg to 0.49.0
⬆️ Update Rust crate usvg to 0.49.0