From 01b086fb61fbbb52cbfb4d9f7db848441210e9c9 Mon Sep 17 00:00:00 2001 From: "Sunrim KIM (keen)" <3han5chou7@gmail.com> Date: Thu, 17 Jul 2014 20:47:13 +0900 Subject: [PATCH] fix a bug of `string-copy!` with same dist and src --- src/string.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/string.c b/src/string.c index 6015688c..73dba061 100644 --- a/src/string.c +++ b/src/string.c @@ -350,6 +350,9 @@ pic_str_string_copy_ip(pic_state *pic) case 4: end = pic_strlen(from); } + if (to == from) { + from = pic_substr(pic, from, 0, end); + } while (start < end) { pic_str_set(pic, to, at++, pic_str_ref(pic, from, start++));