mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
vim-patch:8.0.0305 (#7265)
Problem: Invalid memory access when option has duplicate flag.
Solution: Correct pointer computation. (Dominique Pelle, closes vim/vim#1442)
aaaf57d8a9
This commit is contained in:
parent
9d6bac3219
commit
e53af2b1f5
@ -1749,7 +1749,7 @@ do_set (
|
|||||||
|
|
||||||
if (flags & P_FLAGLIST) {
|
if (flags & P_FLAGLIST) {
|
||||||
// Remove flags that appear twice.
|
// Remove flags that appear twice.
|
||||||
for (s = newval; *s; s++) {
|
for (s = newval; *s;) {
|
||||||
// if options have P_FLAGLIST and P_ONECOMMA such as
|
// if options have P_FLAGLIST and P_ONECOMMA such as
|
||||||
// 'whichwrap'
|
// 'whichwrap'
|
||||||
if (flags & P_ONECOMMA) {
|
if (flags & P_ONECOMMA) {
|
||||||
@ -1757,15 +1757,16 @@ do_set (
|
|||||||
&& vim_strchr(s + 2, *s) != NULL) {
|
&& vim_strchr(s + 2, *s) != NULL) {
|
||||||
// Remove the duplicated value and the next comma.
|
// Remove the duplicated value and the next comma.
|
||||||
STRMOVE(s, s + 2);
|
STRMOVE(s, s + 2);
|
||||||
s -= 2;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((!(flags & P_COMMA) || *s != ',')
|
if ((!(flags & P_COMMA) || *s != ',')
|
||||||
&& vim_strchr(s + 1, *s) != NULL) {
|
&& vim_strchr(s + 1, *s) != NULL) {
|
||||||
STRMOVE(s, s + 1);
|
STRMOVE(s, s + 1);
|
||||||
s--;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,12 @@ function! Test_whichwrap()
|
|||||||
set whichwrap+=h,l
|
set whichwrap+=h,l
|
||||||
call assert_equal('b,s,h,l', &whichwrap)
|
call assert_equal('b,s,h,l', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap=h,h
|
||||||
|
call assert_equal('h', &whichwrap)
|
||||||
|
|
||||||
|
set whichwrap=h,h,h
|
||||||
|
call assert_equal('h', &whichwrap)
|
||||||
|
|
||||||
set whichwrap&
|
set whichwrap&
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -647,7 +647,7 @@ static const int included_patches[] = {
|
|||||||
308,
|
308,
|
||||||
307,
|
307,
|
||||||
// 306,
|
// 306,
|
||||||
// 305,
|
305,
|
||||||
// 304,
|
// 304,
|
||||||
// 303,
|
// 303,
|
||||||
// 302,
|
// 302,
|
||||||
|
Loading…
Reference in New Issue
Block a user