thread '<unnamed>' panicked at crates\usvg\src\text\layout.rs:1505:35: begin > end (2 > 0) when slicing `الويب`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 4.1k
- Forks
- 348
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 3
Description
Hi,
My context is Windows 11 (latest public version), compiling with Visual Studio 2026. I use the static lib, built myself using cargo.
I have no problem in general with the library, but with at least one specific test file of yours I get a crash. I'm using this simple console app:
#include <Windows.h>
#include "E:\github\resvg\crates\c-api\resvg.h"
#pragma comment(lib, "E:\\github\\resvg\\target\\release\\resvg.lib")
#pragma comment(lib, "Ws2_32.lib")
#pragma comment(lib, "Userenv.lib")
#pragma comment(lib, "ntdll.lib")
int main()
{
SetEnvironmentVariable(L"RUST_BACKTRACE", L"full");
resvg_init_log();
resvg_options* opt = resvg_options_create();
resvg_options_load_system_fonts(opt);
resvg_render_tree* tree;
auto err = resvg_parse_tree_from_file("E:\\github\\resvg\\crates\\resvg\\tests\\tests\\text\\font-kerning\\arabic-script.svg", opt, &tree);
...
}
thread '<unnamed>' (32232) panicked at crates\usvg\src\text\layout.rs:1505:35:
begin > end (2 > 0) when slicing `الويب`
stack backtrace:
0: 0x7ff6fbbea330 - std::backtrace_rs::backtrace::win64::trace
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
1: 0x7ff6fbbea330 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ff6fbbea330 - std::sys::backtrace::_print_fmt
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\sys\backtrace.rs:74
3: 0x7ff6fbbea330 - std::sys::backtrace::impl$0::print::impl$0::fmt
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\sys\backtrace.rs:44
4: 0x7ff6fbb96d61 - core::fmt::write
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\core\src\fmt\mod.rs:0
5: 0x7ff6fbbfed14 - std::io::default_write_fmt
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\io\mod.rs:639
6: 0x7ff6fbbfed14 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\io\mod.rs:1994
7: 0x7ff6fbbb8c8f - std::sys::backtrace::BacktraceLock::print
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\sys\backtrace.rs:47
8: 0x7ff6fbbb8c8f - std::panicking::default_hook::closure$0
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\panicking.rs:292
9: 0x7ff6fbbda3fd - std::panicking::default_hook
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\panicking.rs:319
10: 0x7ff6fbbda774 - std::panicking::panic_with_hook
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\panicking.rs:825
11: 0x7ff6fbbb8dc4 - std::panicking::panic_handler::closure$0
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\panicking.rs:698
12: 0x7ff6fbbb580f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::panic_handler::closure_env$0,never$>
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\sys\backtrace.rs:182
13: 0x7ff6fbbb9e6e - std::panicking::panic_handler
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\std\src\panicking.rs:689
14: 0x7ff6fbf56f7d - core::panicking::panic_fmt
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\core\src\panicking.rs:80
15: 0x7ff6fbb972c0 - core::str::slice_error_fail_rt
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\core\src\str\mod.rs:102
16: 0x7ff6fbf56918 - core::str::slice_error_fail
at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library\core\src\str\mod.rs:69
17: 0x7ff6fbd79a21 - fontdb::Database::with_face_data::h2e96d068f96c7839
18: 0x7ff6fbd7387d - fontdb::Database::with_face_data::h2e96d068f96c7839
19: 0x7ff6fbdaa610 - usvg::text::layout::layout_text::haf4a225e1f32f647
20: 0x7ff6fbca4f59 - usvg::text::convert::h0ed7e4b2f301ab3a
21: 0x7ff6fbc84424 - usvg::parser::text::convert::h55affc065c43c436
22: 0x7ff6fbc51330 - usvg::parser::converter::convert_children::h57cf2bc760faf6f6
23: 0x7ff6fbc5110a - usvg::parser::converter::convert_element::ha79f7227414b3921
24: 0x7ff6fbc4fc24 - usvg::parser::converter::convert_group::h96224e70dbab6bfb
25: 0x7ff6fbc50f01 - usvg::parser::converter::convert_element::ha79f7227414b3921
26: 0x7ff6fbc511a3 - usvg::parser::converter::convert_children::h57cf2bc760faf6f6
27: 0x7ff6fbc5110a - usvg::parser::converter::convert_element::ha79f7227414b3921
28: 0x7ff6fbc4fc24 - usvg::parser::converter::convert_group::h96224e70dbab6bfb
29: 0x7ff6fbc50f01 - usvg::parser::converter::convert_element::ha79f7227414b3921
30: 0x7ff6fbc511a3 - usvg::parser::converter::convert_children::h57cf2bc760faf6f6
31: 0x7ff6fbc4a273 - usvg::parser::converter::convert_doc::hac73b42f39263787
32: 0x7ff6fbc19bb9 - usvg::parser::<impl usvg::tree::Tree>::from_str::h9ff03229df6d0b95
33: 0x7ff6fbc19d66 - usvg::parser::<impl usvg::tree::Tree>::from_data::hfedf69decc63a57b
34: 0x7ff6fbb84da9 - resvg_parse_tree_from_file
35: 0x7ff6fbf503f0 - main
at E:\smo\work\ConsoleApplication17\ConsoleApplication17.cpp:18
36: 0x7ff6fbf50e29 - invoke_main
at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
37: 0x7ff6fbf50cd2 - __scrt_common_main_seh
at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
38: 0x7ff6fbf50b8e - __scrt_common_main
at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:330
39: 0x7ff6fbf50ebe - mainCRTStartup
at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:16
40: 0x7ffb464ae8d7 - BaseThreadInitThunk
41: 0x7ffb472cc3fc - RtlUserThreadStart
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/usvg/src/text/layout.rs at line 1505 and reproduce the panic using crates/resvg/tests/tests/text/font-kerning/arabic-script.svg through the reported C API setup. Run the relevant text and font-kerning tests after investigating the Arabic text path; done means the fixture parses and renders without the reported slicing panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100