Stream: bugs

Topic: segfault and use after free panic


view this post on Zulip Matthieu Pizenberg (Dec 01 2025 at 17:47):

I opened an issue here: https://github.com/roc-lang/roc/issues/8532

view this post on Zulip Richard Feldman (Dec 01 2025 at 18:08):

thanks! I'll look into these today

view this post on Zulip Matthieu Pizenberg (Dec 01 2025 at 18:09):

I might find the issue soon. Looking into it now.

view this post on Zulip Matthieu Pizenberg (Dec 01 2025 at 18:22):

The segfault is due to dropPrefix using substringUnsafe without incrementing the ref count it seems. Well the function only increment when the prefix doesn’t match. I’m not sure why.
https://github.com/roc-lang/roc/blob/968e8776e2f69438135b3155829a2d9a556dd201/src/builtins/str.zig#L809

view this post on Zulip Luke Boswell (Dec 01 2025 at 20:32):

Do we have a fix for this yet? I think I can fix it also

view this post on Zulip Matthieu Pizenberg (Dec 01 2025 at 20:33):

Yeah @Richard Feldman has a fix in a branch that isn’t in a PR yet.

view this post on Zulip Matthieu Pizenberg (Dec 01 2025 at 20:34):

https://github.com/roc-lang/roc/compare/main...fix-uaf

view this post on Zulip Matthieu Pizenberg (Dec 01 2025 at 20:36):

I think once it’s merged, and my modulus pr is accepted too (https://github.com/roc-lang/roc/pull/8528), AoC day 1 is easily doable (I have some code ready to share ^^)

view this post on Zulip Luke Boswell (Dec 01 2025 at 20:38):

I'll look at your pr now

view this post on Zulip Luke Boswell (Dec 01 2025 at 20:56):

I am looking at another PR and have to push some commits to fix it, I can add the fix for drop_prefix in there too

view this post on Zulip Luke Boswell (Dec 01 2025 at 21:02):

Cherry picked and added into https://github.com/roc-lang/roc/pull/8520

view this post on Zulip Richard Feldman (Dec 01 2025 at 21:23):

fix for the use-after-free: https://github.com/roc-lang/roc/pull/8535

view this post on Zulip Luke Boswell (Dec 01 2025 at 21:28):

I resolved some merge conflicts between these branches so no harm that commit being in both PRs


Last updated: Dec 21 2025 at 12:15 UTC