Stream: bugs

Topic: Double-free on string where len >= 24


view this post on Zulip Norbert Hajagos (Dec 01 2025 at 19:20):

I have ~1 hour to look into this starting now, so good chance I can't resolve it. Repro:

module []
# happens with strings of length 24 and above
expect("123456789012345678901234" != "")

run roc test

Error message + stack trace:

view this post on Zulip Richard Feldman (Dec 01 2025 at 19:33):

I can fix this, thanks for the repro!

view this post on Zulip Norbert Hajagos (Dec 01 2025 at 19:55):

Np! Meanwhile expanding my mind about the interpreter so that next time I can fix it too :)

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

I'm pretty sure this is fixed in https://github.com/roc-lang/roc/pull/8527
It's the same issue as https://github.com/roc-lang/roc/issues/8525 I think

view this post on Zulip Norbert Hajagos (Dec 01 2025 at 20:11):

I know you're on it, but I'm just using this issue to learn. Sharing this, since first time I used the Zed debugger:
defer -ed decref on lhs and rhs: https://github.com/roc-lang/roc/blob/968e8776e2f69438135b3155829a2d9a556dd201/src/eval/interpreter.zig#L11865

looping through the [lhs, rhs] array and decref-ing them.
https://github.com/roc-lang/roc/blob/968e8776e2f69438135b3155829a2d9a556dd201/src/eval/interpreter.zig#L11962-L11969

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

https://github.com/roc-lang/roc/pull/8535 includes a fix for this!

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

it was still reproducing on there

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

so the earlier PRs didn't fix it


Last updated: Dec 21 2025 at 12:15 UTC