Problem: heap-buffer-overflow with 'nostartofline' and Ex command in
tag file.
Solution: Set cursor column when moving cursor to line 1 (zeertzjq).
closes: #16796
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
++sandbox;
#endif
curwin->w_cursor.lnum = 1; // start command in line 1
+ curwin->w_cursor.col = 0;
+ curwin->w_cursor.coladd = 0;
do_cmdline_cmd(pbuf);
retval = OK;
set tags& cpoptions-=t
endfunc
+func Test_tag_excmd_with_nostartofline()
+ call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
+ \ "f\tXfile\tascii"],
+ \ 'Xtags', 'D')
+ call writefile(['f', 'foobar'], 'Xfile', 'D')
+
+ set nostartofline
+ new Xfile
+ setlocal tags=Xtags
+ normal! G$
+ " This used to cause heap-buffer-overflow
+ tag f
+
+ bwipe!
+ set startofline&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1172,
/**/
1171,
/**/