From bebdf1dab345471222f6755c574d04596fea92fd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 3 Sep 2023 13:47:55 +0800 Subject: vim-patch:9.0.1848: [security] buffer-overflow in vim_regsub_both() (#25001) Problem: buffer-overflow in vim_regsub_both() Solution: Check remaining space https://github.com/vim/vim/commit/ced2c7394aafdc90fb7845e09b3a3fee23d48cb1 The change to do_sub() looks confusing. Maybe it's an overflow check? Then the crash may not be applicable to Nvim because of different casts. The test also looks confusing. It seems to source itself recursively. Also don't call strlen() twice on evaluation result. N/A patches for version.c: vim-patch:9.0.1849: CI error on different signedness in ex_cmds.c vim-patch:9.0.1853: CI error on different signedness in regexp.c Co-authored-by: Christian Brabandt --- test/old/testdir/crash/vim_regsub_both | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/old/testdir/crash/vim_regsub_both (limited to 'test/old/testdir/crash/vim_regsub_both') diff --git a/test/old/testdir/crash/vim_regsub_both b/test/old/testdir/crash/vim_regsub_both new file mode 100644 index 0000000000..a82b205c8f --- /dev/null +++ b/test/old/testdir/crash/vim_regsub_both @@ -0,0 +1,10 @@ +fu R() +sil!norm0z= +endf +cal R() +s/\%')/\=R() +d +no0 normyynore sm:vs0@vvvvvvvvvvse()dir(¼Xtest=csd{so88 +vs +0scr +so -- cgit