From fd7b9fc41e200c782fd05496c26fd7f4a35cf651 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Sun, 6 Nov 2022 18:13:52 +1000 Subject: [PATCH] Fix (revert) sys_read_term_from_chars/4, re issue #74 --- src/streams.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/streams.c b/src/streams.c index 86899e0ff..552dcc58f 100644 --- a/src/streams.c +++ b/src/streams.c @@ -3881,7 +3881,11 @@ static bool fn_sys_read_term_from_chars_4(query *q) const char *ptr = strstr(src, rest); size_t off = ptr - src; size_t len = srclen - off; - check_heap_error(make_slice(q, &tmp, p_chars, off, len)); + + if (!is_string(p_chars)) + check_heap_error(make_string(&tmp, rest)); + else + check_heap_error(make_slice(q, &tmp, p_chars, off, len)); } else { make_atom(&tmp, g_nil_s); }