diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-04-07 09:44:12 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-04-07 09:44:12 (GMT) |
commit | 741ee5b0cbad3670fe1bde6bf53866150d60951e (patch) | |
tree | db373ca6c5604227e2149ccaf96289edc61b1972 | |
parent | b4f99cb2ddffc2639186270b87d2ff9d85c23088 (diff) | |
parent | 0970af5f4951894b38cb6e9dcc6b64cdb7e4a41a (diff) | |
download | tk-741ee5b0cbad3670fe1bde6bf53866150d60951e.zip tk-741ee5b0cbad3670fe1bde6bf53866150d60951e.tar.gz tk-741ee5b0cbad3670fe1bde6bf53866150d60951e.tar.bz2 |
merge core-8-6-branch. Selected harmless androwish changes.
-rw-r--r-- | generic/tkImgPNG.c | 2 | ||||
-rw-r--r-- | generic/tkWindow.c | 11 | ||||
-rw-r--r-- | tests/window.test | 4 |
3 files changed, 13 insertions, 4 deletions
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index 2ee515b..c6e3029 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -335,7 +335,7 @@ InitPNGImage( if (Tcl_ZlibStreamInit(NULL, dir, TCL_ZLIB_FORMAT_ZLIB, TCL_ZLIB_COMPRESS_DEFAULT, NULL, &pngPtr->stream) != TCL_OK) { - if (interp) { + if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "zlib initialization failed", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "ZLIB_INIT", NULL); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 3c6172b..f19204c 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1221,10 +1221,12 @@ Tk_CreateWindowFromPath( /* * Strip the parent's name out of pathName (it's everything up to the last - * dot). There are two tricky parts: (a) must copy the parent's name + * dot). There are three tricky parts: (a) must copy the parent's name * somewhere else to avoid modifying the pathName string (for large names, * space for the copy will have to be malloc'ed); (b) must special-case - * the situation where the parent is ".". + * the situation where the parent is "."; (c) the parent's name cannot be + * only 1 character long because it should include both a leading dot and + * at least one additional character. */ p = strrchr(pathName, '.'); @@ -1243,6 +1245,11 @@ Tk_CreateWindowFromPath( if (numChars == 0) { *p = '.'; p[1] = '\0'; + } else if (numChars == 1) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad window path name \"%s\"", pathName)); + Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); + return NULL; } else { strncpy(p, pathName, (size_t) numChars); p[numChars] = '\0'; diff --git a/tests/window.test b/tests/window.test index fea695a..f02db3e 100644 --- a/tests/window.test +++ b/tests/window.test @@ -39,7 +39,9 @@ test window-1.1 {Tk_CreateWindowFromPath procedure, parent dead} -setup { while executing "button .t.b -text hello" (command bound to event)}} - +test window-1.2 {Tk_CreateWindowFromPath procedure, pathname starting with two dots} -body { + label ..mylabel +} -returnCodes error -result {bad window path name "..mylabel"} # Most of the tests below don't produce meaningful results; they # will simply dump core if there are bugs. |