roc/test/fx/stdin_while_uaf.roc
Richard Feldman fae5ddbbe3
Fix double-decref bug in binop_apply and unary_op_apply
When handling low-level lambdas (like Str.is_eq), the code was decrefing
arguments with borrow semantics, but the defer statements at the top of
these functions already handle decrefing. This caused a double-free when
comparing heap-allocated strings (24+ characters).

The fix removes the explicit decrefs in the low-level lambda paths since
the defer statements already handle cleanup.
2025-12-12 09:01:54 -05:00

18 lines
357 B
Text

app [main!] { pf: platform "./platform/main.roc" }
import pf.Stdin
import pf.Stdout
main! = || {
# Read lines until empty string
var $count = 0
var $continue = True
while $continue {
line = Stdin.line!()
Stdout.line!(line)
$count = $count + 1
if line == "" {
$continue = False
}
}
}