mirror of
https://github.com/vim/vim.git
synced 2025-08-23 19:34:27 -04:00
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Problem: Using utfc_ptr2char_len() when length is negative. Solution: Check value of length. (closes #10760)
This commit is contained in:
parent
0c740e745a
commit
4dc513a22c
21
src/screen.c
21
src/screen.c
@ -1571,21 +1571,18 @@ screen_puts_len(
|
|||||||
// check if this is the first byte of a multibyte
|
// check if this is the first byte of a multibyte
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
if (enc_utf8 && len > 0)
|
mbyte_blen = enc_utf8 && len > 0
|
||||||
mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr));
|
? utfc_ptr2len_len(ptr, (int)((text + len) - ptr))
|
||||||
else
|
: (*mb_ptr2len)(ptr);
|
||||||
mbyte_blen = (*mb_ptr2len)(ptr);
|
|
||||||
if (enc_dbcs == DBCS_JPNU && c == 0x8e)
|
if (enc_dbcs == DBCS_JPNU && c == 0x8e)
|
||||||
mbyte_cells = 1;
|
mbyte_cells = 1;
|
||||||
else if (enc_dbcs != 0)
|
else if (enc_dbcs != 0)
|
||||||
mbyte_cells = mbyte_blen;
|
mbyte_cells = mbyte_blen;
|
||||||
else // enc_utf8
|
else // enc_utf8
|
||||||
{
|
{
|
||||||
if (len >= 0)
|
u8c = len >= 0
|
||||||
u8c = utfc_ptr2char_len(ptr, u8cc,
|
? utfc_ptr2char_len(ptr, u8cc, (int)((text + len) - ptr))
|
||||||
(int)((text + len) - ptr));
|
: utfc_ptr2char(ptr, u8cc);
|
||||||
else
|
|
||||||
u8c = utfc_ptr2char(ptr, u8cc);
|
|
||||||
mbyte_cells = utf_char2cells(u8c);
|
mbyte_cells = utf_char2cells(u8c);
|
||||||
#ifdef FEAT_ARABIC
|
#ifdef FEAT_ARABIC
|
||||||
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
|
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
|
||||||
@ -1599,8 +1596,10 @@ screen_puts_len(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc,
|
nc = len >= 0
|
||||||
(int)((text + len) - ptr - mbyte_blen));
|
? utfc_ptr2char_len(ptr + mbyte_blen, pcc,
|
||||||
|
(int)((text + len) - ptr - mbyte_blen))
|
||||||
|
: utfc_ptr2char(ptr + mbyte_blen, pcc);
|
||||||
nc1 = pcc[0];
|
nc1 = pcc[0];
|
||||||
}
|
}
|
||||||
pc = prev_c;
|
pc = prev_c;
|
||||||
|
@ -735,6 +735,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 */
|
||||||
|
/**/
|
||||||
|
70,
|
||||||
/**/
|
/**/
|
||||||
69,
|
69,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user