From 547876db1cb424ef4cbc2890eabbe34157cfa079 Mon Sep 17 00:00:00 2001 From: jniewerth Date: Sun, 20 Aug 2017 13:30:03 +0200 Subject: [PATCH] Fix "use-after-relocate" in stream_to_string cvalue_string() can cause a gc - this potentially makes the ios_t-pointer that is cached in the local variable "st" invalid. --- iostream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iostream.c b/iostream.c index 53ec822..9f0d3f8 100644 --- a/iostream.c +++ b/iostream.c @@ -389,7 +389,7 @@ value_t stream_to_string(value_t *ps) n = st->size; str = cvalue_string(n); memcpy(cvalue_data(str), value2c(ios_t*,*ps)->buf, n); - ios_trunc(st, 0); + ios_trunc(value2c(ios_t*,*ps), 0); } else { char *b = ios_takebuf(st, &n); n--;