Recently I was integrating the charts library to my project and found that SVG view causes an app to crash. Upon further research I was able to crash SVG example from iced by feeding it with a very simple and innocent looking SVG. Looks like even GitHub previewer is not able to render it.
Please note that this only crashes when dependency is set to iced = "0.1.1" instead of a local path. When local version is used, all is working as expected (at least for me). Probably some dependency introduced a bug that causes this crash.
I've prepared a fork of examples/svg that reproduces the bug on my setup. When run it crashes with the following output:
korvin@pi:~/work/iced/examples/svg$ RUST_BACKTRACE=1 cargo run -p svg
Finished dev [unoptimized + debuginfo] target(s) in 0.12s
Running `/home/korvin/work/iced/target/debug/svg`
Warning: Unrecognized CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number -- (0x 402083) assuming VK_API_VERSION_1_1.
thread 'main' panicked at 'index out of bounds: the len is 5170 but the index is 794413', /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/raqote-0.6.4/src/blitter.rs:124:13
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:217
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:526
11: rust_begin_unwind
at src/libstd/panicking.rs:437
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:85
13: core::panicking::panic_bounds_check
at src/libcore/panicking.rs:62
14: <usize as core::slice::SliceIndex<[T]>>::index_mut
at /home/korvin/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/slice/mod.rs:3009
15: core::slice::<impl core::ops::index::IndexMut<I> for [T]>::index_mut
at /home/korvin/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/slice/mod.rs:2866
16: <alloc::vec::Vec<T> as core::ops::index::IndexMut<I>>::index_mut
at /home/korvin/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc/vec.rs:1987
17: <raqote::blitter::MaskBlitter as raqote::blitter::RasterBlitter>::blit_span
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/raqote-0.6.4/src/blitter.rs:124
18: raqote::rasterizer::Rasterizer::scan_edges
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/raqote-0.6.4/src/rasterizer.rs:487
19: raqote::rasterizer::Rasterizer::rasterize
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/raqote-0.6.4/src/rasterizer.rs:559
20: raqote::draw_target::DrawTarget::fill
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/raqote-0.6.4/src/draw_target.rs:504
21: raqote::draw_target::DrawTarget::stroke
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/raqote-0.6.4/src/draw_target.rs:494
22: resvg::backend_raqote::style::stroke
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/resvg-0.8.0/src/backend_raqote/style.rs:129
23: resvg::backend_raqote::path::draw
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/resvg-0.8.0/src/backend_raqote/path.rs:46
24: resvg::backend_raqote::render_node
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/resvg-0.8.0/src/backend_raqote/mod.rs:234
25: resvg::backend_raqote::render_group
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/resvg-0.8.0/src/backend_raqote/mod.rs:258
26: resvg::backend_raqote::render_node
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/resvg-0.8.0/src/backend_raqote/mod.rs:231
27: resvg::backend_raqote::render_node_to_canvas
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/resvg-0.8.0/src/backend_raqote/mod.rs:198
28: resvg::backend_raqote::render_to_canvas
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/resvg-0.8.0/src/backend_raqote/mod.rs:178
29: iced_wgpu::image::vector::Cache::upload
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_wgpu-0.2.3/src/image/vector.rs:110
30: iced_wgpu::image::Pipeline::draw
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_wgpu-0.2.3/src/image.rs:305
31: iced_wgpu::renderer::Renderer::flush
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_wgpu-0.2.3/src/renderer.rs:376
32: iced_wgpu::renderer::Renderer::draw
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_wgpu-0.2.3/src/renderer.rs:114
33: <iced_wgpu::window::backend::Backend as iced_native::window::backend::Backend>::draw
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_wgpu-0.2.3/src/window/backend.rs:97
34: iced_winit::application::Application::run::{{closure}}
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_winit-0.1.0/src/application.rs:331
35: winit::platform_impl::platform::sticky_exit_callback
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.2/src/platform_impl/linux/mod.rs:698
36: winit::platform_impl::platform::x11::EventLoop<T>::run_return
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.2/src/platform_impl/linux/x11/mod.rs:312
37: winit::platform_impl::platform::x11::EventLoop<T>::run
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.2/src/platform_impl/linux/x11/mod.rs:390
38: winit::platform_impl::platform::EventLoop<T>::run
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.2/src/platform_impl/linux/mod.rs:645
39: winit::event_loop::EventLoop<T>::run
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.2/src/event_loop.rs:149
40: iced_winit::application::Application::run
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_winit-0.1.0/src/application.rs:214
41: iced::application::Application::run
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced-0.1.1/src/application.rs:201
42: iced::sandbox::Sandbox::run
at /home/korvin/.cargo/registry/src/github.com-1ecc6299db9ec823/iced-0.1.1/src/sandbox.rs:139
43: svg::main
at examples/svg/src/main.rs:4
44: std::rt::lang_start::{{closure}}
at /home/korvin/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:67
45: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:52
46: std::panicking::try::do_call
at src/libstd/panicking.rs:348
47: std::panicking::try
at src/libstd/panicking.rs:325
48: std::panic::catch_unwind
at src/libstd/panic.rs:394
49: std::rt::lang_start_internal
at src/libstd/rt.rs:51
50: std::rt::lang_start
at /home/korvin/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/rt.rs:67
51: main
52: __libc_start_main
53: _start
P.S.: When using local iced as a dependency, everything works just fine:
This is a weird one.
Recently I was integrating the
charts
library to my project and found that SVG view causes an app to crash. Upon further research I was able to crash SVG example from iced by feeding it with a very simple and innocent looking SVG. Looks like even GitHub previewer is not able to render it.Please note that this only crashes when dependency is set to
iced = "0.1.1"
instead of a local path. When local version is used, all is working as expected (at least for me). Probably some dependency introduced a bug that causes this crash.I've prepared a fork of examples/svg that reproduces the bug on my setup. When run it crashes with the following output:
P.S.: When using local
iced
as a dependency, everything works just fine: