diff options
author | andreas_kupries <andreas_kupries@noemail.net> | 2008-04-09 18:35:24 (GMT) |
---|---|---|
committer | andreas_kupries <andreas_kupries@noemail.net> | 2008-04-09 18:35:24 (GMT) |
commit | 54d33ff072e86cdd818de0a5b4cb4df8d6a9c4d1 (patch) | |
tree | 65dccc8ef113848eb2542252139a621df32f5b43 /generic/tclIOCmd.c | |
parent | c08df271949a6b0a920c6e25927b896d496c9d45 (diff) | |
download | tcl-54d33ff072e86cdd818de0a5b4cb4df8d6a9c4d1.zip tcl-54d33ff072e86cdd818de0a5b4cb4df8d6a9c4d1.tar.gz tcl-54d33ff072e86cdd818de0a5b4cb4df8d6a9c4d1.tar.bz2 |
* generic/tclIOCmd.c (Tcl_FcopyObjCmd): Added checking of -size
* tests/ioCmd.test (iocmd-15.{13,14}): value to reject negative
values, and values overflowing 32-bit signed. [Bug 1557855]. Basic
patch by Alexandre Ferrieux <ferrieux@users.sourceforge.net>, with
modifications from me to separate overflow from true negative
value. Extended testsuite.
FossilOrigin-Name: 7b56d24c8a60ea5521a97778dfc86f72d27070c8
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r-- | generic/tclIOCmd.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 300bef0..48debd8 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOCmd.c,v 1.15.2.3 2008/02/26 22:30:26 hobbs Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.15.2.4 2008/04/09 18:35:27 andreas_kupries Exp $ */ #include "tclInt.h" @@ -1542,6 +1542,20 @@ Tcl_FcopyObjCmd(dummy, interp, objc, objv) if (Tcl_GetIntFromObj(interp, objv[i+1], &toRead) != TCL_OK) { return TCL_ERROR; } + if (toRead<0) { + Tcl_WideInt w; + if (Tcl_GetWideIntFromObj(interp, objv[i+1], &w) != TCL_OK) { + return TCL_ERROR; + } + if (w >= (Tcl_WideInt)0) { + Tcl_AppendResult(interp, + "integer value to large to represent as 32bit signed value", + NULL); + } else { + Tcl_AppendResult(interp, "negative size forbidden", NULL); + } + return TCL_ERROR; + } break; case FcopyCommand: cmdPtr = objv[i+1]; |