mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.1531: crash when register contents ends up being invalid
Problem: Crash when register contents ends up being invalid. Solution: Check "y_array" is not NULL.
This commit is contained in:
parent
aa6ba308a1
commit
d1ae8366af
@ -301,7 +301,7 @@ get_register(
|
|||||||
if (copy)
|
if (copy)
|
||||||
{
|
{
|
||||||
// If we run out of memory some or all of the lines are empty.
|
// If we run out of memory some or all of the lines are empty.
|
||||||
if (reg->y_size == 0)
|
if (reg->y_size == 0 || y_current->y_array == NULL)
|
||||||
reg->y_array = NULL;
|
reg->y_array = NULL;
|
||||||
else
|
else
|
||||||
reg->y_array = ALLOC_MULT(char_u *, reg->y_size);
|
reg->y_array = ALLOC_MULT(char_u *, reg->y_size);
|
||||||
|
@ -835,6 +835,23 @@ func Test_end_reg_executing()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" This was causing a crash because y_append was ending up being NULL
|
||||||
|
func Test_zero_y_append()
|
||||||
|
" Run in a separate Vim instance because changing 'encoding' may cause
|
||||||
|
" trouble for later tests.
|
||||||
|
let lines =<< trim END
|
||||||
|
d
|
||||||
|
silent ?n
|
||||||
|
next <sfile>
|
||||||
|
so
|
||||||
|
sil! norm 0VPSP
|
||||||
|
set enc=latin1
|
||||||
|
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XTest_zero_y_append', 'D')
|
||||||
|
call RunVim([], [], '-u NONE -i NONE -e -s -S XTest_zero_y_append -c qa\!')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Make sure that y_append is correctly reset
|
" Make sure that y_append is correctly reset
|
||||||
" and the previous register is working as expected
|
" and the previous register is working as expected
|
||||||
func Test_register_y_append_reset()
|
func Test_register_y_append_reset()
|
||||||
|
@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
1531,
|
||||||
/**/
|
/**/
|
||||||
1530,
|
1530,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user