[brlcad-commits] SF.net SVN: brlcad:[32638] brlcad/trunk/src/other/tcl/generic/tclIO.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <bo...@us...> - 2008-09-11 19:41:26
|
Revision: 32638 http://brlcad.svn.sourceforge.net/brlcad/?rev=32638&view=rev Author: bob1961 Date: 2008-09-11 19:41:34 +0000 (Thu, 11 Sep 2008) Log Message: ----------- Added check for exceeding max int. Modified Paths: -------------- brlcad/trunk/src/other/tcl/generic/tclIO.c Modified: brlcad/trunk/src/other/tcl/generic/tclIO.c =================================================================== --- brlcad/trunk/src/other/tcl/generic/tclIO.c 2008-09-11 14:41:43 UTC (rev 32637) +++ brlcad/trunk/src/other/tcl/generic/tclIO.c 2008-09-11 19:41:34 UTC (rev 32638) @@ -5431,6 +5431,8 @@ char *src, *dst; Tcl_EncodingState oldState; int encEndFlagSuppressed = 0; + static int mflag = 0; + static int maxInt = 2147483647; factor = *factorPtr; offset = *offsetPtr; @@ -5460,12 +5462,24 @@ * larger. */ + if (mflag) { + mflag = 0; + return -1; + } + length = offset * 2; if (offset < dstNeeded) { length = offset + dstNeeded; } - spaceLeft = length - offset; - length += TCL_UTF_MAX + 1; + + if (length < 0) { + length = maxInt; + mflag = 1; + spaceLeft = length - offset; + } else { + spaceLeft = length - offset; + length += TCL_UTF_MAX + 1; + } Tcl_SetObjLength(objPtr, length); } if (toRead == srcLen) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |