summaryrefslogtreecommitdiffstats
path: root/generic/tkImage.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2000-11-23 13:50:10 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2000-11-23 13:50:10 (GMT)
commit30949cbba8e868da7e1fa1e4200be6385bd07797 (patch)
treec925f625f3b1f913bfea06c7acffe3d7b8521474 /generic/tkImage.c
parente8a9f7a1eb829433dc7432244df8f5d1d7798d13 (diff)
downloadtk-30949cbba8e868da7e1fa1e4200be6385bd07797.zip
tk-30949cbba8e868da7e1fa1e4200be6385bd07797.tar.gz
tk-30949cbba8e868da7e1fa1e4200be6385bd07797.tar.bz2
Fixed bug #120819 by prohibiting images from starting with a period;
I'm still not quite sure what exactly was going wrong in the bug, but I suspect the problem might have actually been due to the deletion of all images while in the midst of creating an image. The restriction is pretty light when it comes to existing code, since it previously caused a core dump due to an image typePtr field being set to random garbage, an indication of over-eager use of free()...
Diffstat (limited to 'generic/tkImage.c')
-rw-r--r--generic/tkImage.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 31ac3bb..2ebb5de 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkImage.c,v 1.7 2000/05/15 18:21:47 ericm Exp $
+ * RCS: @(#) $Id: tkImage.c,v 1.8 2000/11/23 13:50:11 dkf Exp $
*/
#include "tkInt.h"
@@ -232,6 +232,18 @@ Tk_ImageObjCmd(clientData, interp, objc, objv)
sprintf(idString, "image%d", dispPtr->imageId);
name = idString;
firstOption = 3;
+ } else if (arg[0] == '.') {
+ /*
+ * It is a really bad idea to create an image with the
+ * same name as the root window, and who knows what
+ * will happen if any other (potential) window name is
+ * used. So it's prohibited for safety, so stopping
+ * bug #120819
+ */
+ Tcl_AppendResult(interp, "image names cannot start with "
+ "period symbols: \"", arg, "\" is illegal",
+ (char *)NULL);
+ return TCL_ERROR;
} else {
name = arg;
firstOption = 4;