commit 77500c5ad5c628a1ba469c2a115c1de3fc8b818a
parent e3913c0fc22f76b116de8f0c6d7a40395755f1d2
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun, 10 Aug 2025 07:23:59 +0800
vim-patch:9.1.1611: possible undefined behaviour in mb_decompose() (#35275)
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 <aron.harnasi@gmail.com>
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git 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;
}
}