Problem: When a tagfunc returns a "cmd" that is neither a line number nor
a search pattern, the tag entry is corrupted: the "kind" field is
lost and taglist() returns a mangled "cmd".
Solution: Accept any Ex command in "cmd" as in a tags file, terminate a
generic command with a bar so the trailing fields are preserved,
and reject a value that cannot be stored in a tag line with E987.
Supersedes #20790, opened as a separate PR at the author's request.
closes #20781
#20790 wrapped every "cmd" with a leading ":" and a trailing "|". That
regressed a search-pattern jump: with cmd = "/bar/" the cursor landed on
column 1 instead of the matched column 5, because the stored ":/bar/|;""
no longer took the do_search() path and fell through to ":/bar/", which
only moves by line.
This PR classifies "cmd" like a tags file address instead:
A generic command runs on a tag jump under 'secure' and the sandbox,
exactly like a command from a tags file. Destructive calls such as
delete(), writefile(), system() and ":!" are blocked (E523/E12), so this
adds no new attack surface.
make test_tagfunc and make test_tagjump both pass.
https://github.com/vim/vim/pull/20828
(3 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()