Tcl Source Code

Artifact [ab320f4a44]
Login

Artifact ab320f4a449359b8bfa0c08bc694217da4d435cd:

Attachment "3166410.patch" to ticket [3166410fff] added by nijtmans 2011-01-31 14:52:30.
*** unix/tclUnixInit.c	2011-01-31 08:28:11.817789927 +0100
--- unix/tclUnixInit.c	2011-01-31 08:50:25.795446269 +0100
***************
*** 1094,1102 ****
--- 1094,1110 ----
  	if (stackGrowsDown) {
  	    tsdPtr->stackBound = (int *) ((char *)tsdPtr->outerVarPtr -
  		    stackSize);
+ 	    if (tsdPtr->stackBound > tsdPtr->outerVarPtr) {
+ 	    	/* overflow, that should never happen, just set it to a very low value */
+ 	    	tsdPtr->stackBound = (int *) (getpagesize() * TCL_RESERVED_STACK_PAGES);
+ 	    }
  	} else {
  	    tsdPtr->stackBound = (int *) ((char *)tsdPtr->outerVarPtr +
  		    stackSize);
+ 	    if (tsdPtr->stackBound < tsdPtr->outerVarPtr) {
+ 	    	/* overflow, that should never happen, just set it to a very high value */
+ 	    	tsdPtr->stackBound = (int *) -(getpagesize() * TCL_RESERVED_STACK_PAGES);
+ 	    }
  	}
      }