Mercurial > vim
changeset 36055:4decbb6d2915 v9.1.0700
patch 9.1.0700: crash with 2byte encoding and glob2regpat()
Commit: https://github.com/vim/vim/commit/1c815b54bbaf872c271d58043e51e56b908c1a20
Author: Christian Brabandt <cb@256bit.org>
Date: Wed Aug 28 22:08:35 2024 +0200
patch 9.1.0700: crash with 2byte encoding and glob2regpat()
Problem: possible crash with 2byte encoding and glob2regpat()
Solution: Skip over character, if it is multi-byte character
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 28 Aug 2024 22:15:02 +0200 |
parents | 681f8574229b |
children | 8519906fc6d4 |
files | src/fileio.c src/testdir/crash/heap_overflow_glob2regpat src/testdir/test_crash.vim src/version.c |
diffstat | 4 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fileio.c +++ b/src/fileio.c @@ -5714,7 +5714,8 @@ file_pat_to_reg_pat( ) *allow_dirs = TRUE; reg_pat[i++] = '\\'; - reg_pat[i++] = *p; + if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) + reg_pat[i++] = *p++; } break; #ifdef BACKSLASH_IN_FILENAME
new file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..8baf6f32533cc548c58dcc6152292e7f23b59345 GIT binary patch literal 200 zc$~8;PE|<FOU_Tp%uBa5N~$bL)h#Va)Ai#j$;?SjE!Iln)-J4JV5sLR%Zq9M|B0)Z zg@r{=&lX6saImoP@MtjG`tnp+cI4)y2!H`Y8CMDe!^0G=yqLEQhB{n9)gU0ikd|MP zld3S2aW<DoZgw$Ou1YF%X3=kk|0-NLNsJ5(3_zjQR3@kY|GAPB>#D1BlJZN6GSf3k rRI7uSU!=tR*U|d#6YSGdV3^ndRGpcdn8VN=mRed`8eCdh5W@`sxUN5Z
--- a/src/testdir/test_crash.vim +++ b/src/testdir/test_crash.vim @@ -222,6 +222,12 @@ func Test_crash1_3() call term_sendkeys(buf, args) call TermWait(buf, 150) + let file = 'crash/heap_overflow_glob2regpat' + let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'" + let args = printf(cmn_args, vim, file) + call term_sendkeys(buf, args) + call TermWait(buf, 50) + " clean up exe buf .. "bw!"