1
0
forked from aniani/vim

patch 9.1.0436: Crash when using '?' as separator for :s

Problem:  Crash when using '?' as separator for :s and pattern contains
          escaped '?'s (after 9.1.0409).
Solution: Always compute startplen. (zeertzjq).

related: neovim/neovim#28935
closes: 14832

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-05-23 17:41:26 +02:00
committed by Christian Brabandt
parent cd79f8fbd3
commit 789679cfc4
3 changed files with 13 additions and 3 deletions

View File

@@ -620,6 +620,7 @@ skip_regexp_ex(
{
magic_T mymagic;
char_u *p = startp;
size_t startplen = STRLEN(startp);
if (magic)
mymagic = MAGIC_ON;
@@ -642,12 +643,9 @@ skip_regexp_ex(
{
if (dirc == '?' && newp != NULL && p[1] == '?')
{
size_t startplen = 0;
// change "\?" to "?", make a copy first.
if (*newp == NULL)
{
startplen = STRLEN(startp);
*newp = vim_strnsave(startp, startplen);
if (*newp != NULL)
p = *newp + (p - startp);