To: vim-dev@vim.org
Subject: Patch 6.1.176
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.1.176
Problem:    When the stack limit is very big a false out-of-stack error may
	    be detected.
Solution:   Add a check for overflow of the stack limit computation. (Jim
	    Dunleavy)
Files:	    src/os_unix.c


*** ../vim61.175/src/os_unix.c	Sun Jul 21 21:35:45 2002
--- src/os_unix.c	Thu Sep 12 21:55:20 2002
***************
*** 609,617 ****
--- 609,626 ----
         )
      {
  	if (stack_grows_downwards)
+ 	{
  	    stack_limit = (char *)((long)&i - ((long)rlp.rlim_cur / 16L * 15L));
+ 	    if (stack_limit >= (char *)&i)
+ 		/* overflow, set to 1/16 of current stack position */
+ 		stack_limit = (char *)((long)&i / 16L);
+ 	}
  	else
+ 	{
  	    stack_limit = (char *)((long)&i + ((long)rlp.rlim_cur / 16L * 15L));
+ 	    if (stack_limit <= (char *)&i)
+ 		stack_limit = NULL;	/* overflow */
+ 	}
      }
  }
  
