From 4ea55109379dd84494cf5e78c90e4bcbae297684 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 11 Feb 2025 22:45:50 +0900 Subject: [PATCH] mruby-compiler (merge_op_string): fix #6477 If two merging strings are the same and registered at the bottom of the pool, we should not remove the slot from the pool. --- mrbgems/mruby-compiler/core/codegen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index f1aee705c..d4975344c 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -870,7 +870,7 @@ merge_op_string(codegen_scope *s, uint16_t dst, uint16_t b1, uint16_t b2, const off = b1; realloc_pool_str(s, p1, len1+len2); memcpy((void*)(p1->u.str+len1), (void*)p2->u.str, len2); - if (used == 0 && b2+1 == s->irep->plen) { + if (b1 != b2 && used == 0 && b2+1 == s->irep->plen) { free_pool_str(s, p2); } break;