Stack overflow in list grouping with linebreak
Description
version: typst 0.14.2 (b33de9de) OS: Endeavour Os
I apologize for the generic title, but I just wrote some typst and got a sigsegv when compiling this code:
#show list: it => {
for item in it.children{
[#item\ ]
}
}
- One
If \ is removed the output is error: maximum grouping depth exceeded
Reproduction URL
No response
Operating system
No response
Typst version
- [ ] I am using the latest version of Typst
Hello @AliothCancer , I created a PR for this issue fixing. Could you please review my updates? Thanks
Hello @AliothCancer , I created a PR for this issue fixing. Could you please review my updates? Thanks
Firstly I want to say that this is my first time doing this, in general I'm newbie so I hope you can guide me if necessary.
I git cloned https://github.com/speedcoder430/typst/tree/refs/heads/fix-list-grouping-stack-overflow and ran cargo build --release then I tried to compile the typst code above and got this:
# version
typst on ๎ main [?] is ๐ฆ v0.14.2 via ๐ฆ v1.92.0 via t v0.14.2
โฏ ./target/release/typst -V
typst 0.14.2 (88356d0b)
typst on ๎ main [?] is ๐ฆ v0.14.2 via ๐ฆ v1.92.0 via t v0.14.2
โฏ ./target/release/typst compile testing_escape_in_list_grouping.typ
thread 'main' (20281) has overflowed its stack
fatal runtime error: stack overflow, aborting
Error: nu::shell::core_dumped
ร External command core dumped
โญโ[entry #12:1:1]
1 โ ./target/release/typst compile testing_escape_in_list_grouping.typ
ยท โโโโโโโโโโโโฌโโโโโโโโโโ
ยท โฐโโ core dumped with SIGABRT (6)
โฐโโโโ
Note: I actually don't remember if I installed typst through cargo binstall or if I've compiled it.
For reference the typst binary I've installed from cargo outputs this:
typst on ๎ main [?] is ๐ฆ v0.14.2 via ๐ฆ v1.92.0 via t v0.14.2
โฏ typst -V
typst 0.14.2 (b33de9de)
typst on ๎ main [?] is ๐ฆ v0.14.2 via ๐ฆ v1.92.0 via t v0.14.2
โฏ typst compile testing_escape_in_list_grouping.typ
Error: nu::shell::core_dumped
ร External command core dumped
โญโ[entry #14:1:1]
1 โ typst compile testing_escape_in_list_grouping.typ
ยท โโโฌโโ
ยท โฐโโ core dumped with SIGSEGV (11)
โฐโโโโ
Hi @AliothCancer , thanks for taking the time to test this!
It looks like you accidentally built from the main branch instead of the fix branch. The version hash in your output (88356d0b) matches main's HEAD, not the fix commit (835f266).
This likely happened because git clone doesn't understand the /tree/refs/heads/... path in the GitHub URL โ it just clones the default branch.
To test the fix branch, you can run:
git clone https://github.com/speedcoder430/typst.git
cd typst
git checkout fix-list-grouping-stack-overflow
cargo build --release
./target/release/typst compile testing_escape_in_list_grouping.typ
With the fix, instead of a stack overflow crash, you should see:
error: maximum grouping depth exceeded
Let me know if it works after switching to the correct branch. Thanks again.
Thanks for guiding me, so here the fixed branch:
typst on ๎ fix-list-grouping-stack-overflow [?] is ๐ฆ v0.14.2 via ๐ฆ v1.92.0 via t v0.14.2
โฏ ./target/release/typst compile testing_escape_in_list_grouping.typ
error: maximum grouping depth exceeded
โโ testing_escape_in_list_grouping.typ:7:0
โ
7 โ - One
โ ^^^^^
It seems the updates are working properly. Now can you approve the PR? https://github.com/typst/typst/pull/7903
I went to https://github.com/typst/typst/pull/7903 and I can click on "Submit comments" I can only write a comment, I cannot click on "Approve", so should I just leave a comment:
"Tested locally on EndeavourOS using the reproduction code from the original issue. The crash is gone and the compiler now correctly returns error: maximum grouping depth exceeded instead of overflowing the stack. Thank you."
?
That's great for me. I hope the project owner can check your feedback as well. Thanks for your help.
Done, cool! You're welcome, this is actually the very first time I do this, I hope your PR will be approved.
Done, cool! You're welcome, this is actually the very first time I do this, I hope your PR will be approved.
Thanks