From 77500c5ad5c628a1ba469c2a115c1de3fc8b818a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 10 Aug 2025 07:23:59 +0800 Subject: [PATCH] vim-patch:9.1.1611: possible undefined behaviour in mb_decompose() (#35275) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: possible undefined behaviour in mb_decompose(), when using the same pointer as argument several times Solution: use separate assignments to avoid reading and writing the same object at the same time (Áron Hárnási) closes: vim/vim#17953 https://github.com/vim/vim/commit/c43a0614d40a3892a9cb2b9d75f61a19a3de0226 Co-authored-by: Áron Hárnási --- src/nvim/regexp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 7a8d963dee..c07831f03d 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -1729,7 +1729,8 @@ static void mb_decompose(int c, int *c1, int *c2, int *c3) *c3 = d.c; } else { *c1 = c; - *c2 = *c3 = 0; + *c2 = 0; + *c3 = 0; } }