mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.2110: [security]: overflow in ex address parsing
Problem: [security]: overflow in ex address parsing Solution: Verify that lnum is positive, before substracting from LONG_MAX [security]: overflow in ex address parsing When parsing relative ex addresses one may unintentionally cause an overflow (because LONG_MAX - lnum will overflow for negative addresses). So verify that lnum is actually positive before doing the overflow check. Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -4644,7 +4644,7 @@ get_address(
|
|||||||
lnum -= n;
|
lnum -= n;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (n >= LONG_MAX - lnum)
|
if (lnum >= 0 && n >= LONG_MAX - lnum)
|
||||||
{
|
{
|
||||||
emsg(_(e_line_number_out_of_range));
|
emsg(_(e_line_number_out_of_range));
|
||||||
goto error;
|
goto error;
|
||||||
|
@@ -724,5 +724,9 @@ func Test_write_after_rename()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" catch address lines overflow
|
||||||
|
func Test_ex_address_range_overflow()
|
||||||
|
call assert_fails(':--+foobar', 'E492:')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -704,6 +704,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 */
|
||||||
|
/**/
|
||||||
|
2110,
|
||||||
/**/
|
/**/
|
||||||
2109,
|
2109,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user