This is a test case:
./vim -u NONE -U NONE -N -c "set enc=latin1|echo '.*d' =~ '\<.*d'"
Unfortunately, I haven't been able to create a test case for this. For
some reason, when running the test suite, it doesn't trigger the crash
(probably, because reg_buf is set somewhere)
Attached is a better patch, I think.
regards,
Christian
--
Willst du die Bescheidenheit des Bescheidenen prüfen, so forsche
nicht, ob er Beifall verschmäht, sondern ob er den Tadel erträgt.
-- Franz Grillparzer
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff --git a/src/regexp.c b/src/regexp.c
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -4052,6 +4052,8 @@
regitem_T *rp;
int no;
int status; /* one of the RA_ values: */
+ buf_T *buf = reg_buf; /* can be null */
+
#define RA_FAIL 1 /* something failed, abort */
#define RA_CONT 2 /* continue in inner loop */
#define RA_BREAK 3 /* break inner loop */
@@ -4063,6 +4065,9 @@
regstack.ga_len = 0;
backpos.ga_len = 0;
+ if (buf == NUL)
+ buf = curbuf;
+
/*
* Repeat until "regstack" is empty.
*/
@@ -4181,7 +4186,7 @@
int cmp = OPERAND(scan)[1];
pos_T *pos;
- pos = getmark_buf(reg_buf, mark, FALSE);
+ pos = getmark_buf(buf, mark, FALSE);
if (pos == NULL /* mark doesn't exist */
|| pos->lnum <= 0 /* mark isn't set (in curbuf) */
|| (pos->lnum == reglnum + reg_firstlnum
@@ -4311,8 +4316,8 @@
#endif
else
{
- if (!vim_iswordc_buf(c, reg_buf)
- || (reginput > regline && vim_iswordc_buf(reginput[-1], reg_buf)))
+ if (!vim_iswordc_buf(c, buf)
+ || (reginput > regline && vim_iswordc_buf(reginput[-1], buf)))
status = RA_NOMATCH;
}
break;
@@ -4335,8 +4340,8 @@
#endif
else
{
- if (!vim_iswordc_buf(reginput[-1], reg_buf)
- || (reginput[0] != NUL && vim_iswordc_buf(c, reg_buf)))
+ if (!vim_iswordc_buf(reginput[-1], buf)
+ || (reginput[0] != NUL && vim_iswordc_buf(c, buf)))
status = RA_NOMATCH;
}
break; /* Matched with EOW */