summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorandreas_kupries <andreas_kupries@noemail.net>2008-04-09 18:36:16 (GMT)
committerandreas_kupries <andreas_kupries@noemail.net>2008-04-09 18:36:16 (GMT)
commit203cc8a10f60a17307a513086d1d7b6cf05400b1 (patch)
tree44ddee7d24d6937590101d3e8526dd532f506393 /generic
parente09c4ebaec4f56407285ded516391afdeb242ed2 (diff)
downloadtcl-203cc8a10f60a17307a513086d1d7b6cf05400b1.zip
tcl-203cc8a10f60a17307a513086d1d7b6cf05400b1.tar.gz
tcl-203cc8a10f60a17307a513086d1d7b6cf05400b1.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: bd84e3f99e9612df3cd9220ab01afaf995827630
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIOCmd.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index c1abee1..3c34845 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.51 2007/12/13 15:23:18 dgp Exp $
+ * RCS: @(#) $Id: tclIOCmd.c,v 1.51.2.1 2008/04/09 18:36:18 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -1643,6 +1643,20 @@ Tcl_FcopyObjCmd(
if (TclGetIntFromObj(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];