|
|
b6500d |
diff -up vim80/src/regexp.c.cve4192 vim80/src/regexp.c
|
|
|
b6500d |
--- vim80/src/regexp.c.cve4192 2022-01-12 15:21:44.792239040 +0100
|
|
|
b6500d |
+++ vim80/src/regexp.c 2022-01-12 15:34:35.190425880 +0100
|
|
|
b6500d |
@@ -4203,9 +4203,9 @@ reg_match_visual(void)
|
|
|
b6500d |
if (lnum < top.lnum || lnum > bot.lnum)
|
|
|
b6500d |
return FALSE;
|
|
|
b6500d |
|
|
|
b6500d |
+ col = (colnr_T)(reginput - regline);
|
|
|
b6500d |
if (mode == 'v')
|
|
|
b6500d |
{
|
|
|
b6500d |
- col = (colnr_T)(reginput - regline);
|
|
|
b6500d |
if ((lnum == top.lnum && col < top.col)
|
|
|
b6500d |
|| (lnum == bot.lnum && col >= bot.col + (*p_sel != 'e')))
|
|
|
b6500d |
return FALSE;
|
|
|
b6500d |
@@ -4220,7 +4220,12 @@ reg_match_visual(void)
|
|
|
b6500d |
end = end2;
|
|
|
b6500d |
if (top.col == MAXCOL || bot.col == MAXCOL)
|
|
|
b6500d |
end = MAXCOL;
|
|
|
b6500d |
- cols = win_linetabsize(wp, regline, (colnr_T)(reginput - regline));
|
|
|
b6500d |
+
|
|
|
b6500d |
+ // getvvcol() flushes rex.line, need to get it again
|
|
|
b6500d |
+ regline = reg_getline(reglnum);
|
|
|
b6500d |
+ reginput = regline + col;
|
|
|
b6500d |
+
|
|
|
b6500d |
+ cols = win_linetabsize(wp, regline, col);
|
|
|
b6500d |
if (cols < start || cols > end - (*p_sel == 'e'))
|
|
|
b6500d |
return FALSE;
|
|
|
b6500d |
}
|
|
|
b6500d |
diff -up vim80/src/testdir/test_regexp_latin.vim.cve4192 vim80/src/testdir/test_regexp_latin.vim
|
|
|
b6500d |
--- vim80/src/testdir/test_regexp_latin.vim.cve4192 2022-01-12 15:21:44.792239040 +0100
|
|
|
b6500d |
+++ vim80/src/testdir/test_regexp_latin.vim 2022-01-12 15:36:12.499693099 +0100
|
|
|
b6500d |
@@ -80,3 +80,13 @@ func Test_using_invalid_visual_position(
|
|
|
b6500d |
/\%V
|
|
|
b6500d |
bwipe!
|
|
|
b6500d |
endfunc
|
|
|
b6500d |
+
|
|
|
b6500d |
+func Test_using_visual_position()
|
|
|
b6500d |
+ " this was using freed memory
|
|
|
b6500d |
+ new
|
|
|
b6500d |
+ exe "norm 0o\<Esc>\<C-V>k\<C-X>o0"
|
|
|
b6500d |
+ /\%V
|
|
|
b6500d |
+ bwipe!
|
|
|
b6500d |
+endfunc
|
|
|
b6500d |
+
|
|
|
b6500d |
+" vim: shiftwidth=2 sts=2 expandtab
|