mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 7.3.916
Problem: Using freed memory when pasting with the mouse (Issue 130). Solution: Get the byte value early. (hint by Dominique Pelle)
This commit is contained in:
34
src/buffer.c
34
src/buffer.c
@@ -3506,7 +3506,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar,
|
|||||||
char_u *p;
|
char_u *p;
|
||||||
char_u *s;
|
char_u *s;
|
||||||
char_u *t;
|
char_u *t;
|
||||||
char_u *linecont;
|
int byteval;
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
win_T *o_curwin;
|
win_T *o_curwin;
|
||||||
buf_T *o_curbuf;
|
buf_T *o_curbuf;
|
||||||
@@ -3573,12 +3573,21 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar,
|
|||||||
fillchar = '-';
|
fillchar = '-';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* Get line & check if empty (cursorpos will show "0-1"). Note that
|
||||||
* Get line & check if empty (cursorpos will show "0-1").
|
* p will become invalid when getting another buffer line. */
|
||||||
* If inversion is possible we use it. Else '=' characters are used.
|
p = ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, FALSE);
|
||||||
*/
|
empty_line = (*p == NUL);
|
||||||
linecont = ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, FALSE);
|
|
||||||
empty_line = (*linecont == NUL);
|
/* Get the byte value now, in case we need it below. This is more
|
||||||
|
* efficient than making a copy of the line. */
|
||||||
|
if (wp->w_cursor.col > (colnr_T)STRLEN(p))
|
||||||
|
byteval = 0;
|
||||||
|
else
|
||||||
|
#ifdef FEAT_MBYTE
|
||||||
|
byteval = (*mb_ptr2char)(p + wp->w_cursor.col);
|
||||||
|
#else
|
||||||
|
byteval = p[wp->w_cursor.col];
|
||||||
|
#endif
|
||||||
|
|
||||||
groupdepth = 0;
|
groupdepth = 0;
|
||||||
p = out;
|
p = out;
|
||||||
@@ -3956,16 +3965,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar,
|
|||||||
case STL_BYTEVAL_X:
|
case STL_BYTEVAL_X:
|
||||||
base = 'X';
|
base = 'X';
|
||||||
case STL_BYTEVAL:
|
case STL_BYTEVAL:
|
||||||
if (wp->w_cursor.col > (colnr_T)STRLEN(linecont))
|
num = byteval;
|
||||||
num = 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
num = (*mb_ptr2char)(linecont + wp->w_cursor.col);
|
|
||||||
#else
|
|
||||||
num = linecont[wp->w_cursor.col];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (num == NL)
|
if (num == NL)
|
||||||
num = 0;
|
num = 0;
|
||||||
else if (num == CAR && get_fileformat(wp->w_buffer) == EOL_MAC)
|
else if (num == CAR && get_fileformat(wp->w_buffer) == EOL_MAC)
|
||||||
|
@@ -728,6 +728,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
916,
|
||||||
/**/
|
/**/
|
||||||
915,
|
915,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user