Tcl Source Code

Artifact [796c64ac73]
Login

Artifact 796c64ac73e7da08719543ce4f4a853ca6cd6683:

Attachment "ctbug.patch" to ticket [484339ffff] added by dgp 2001-12-04 04:43:06.
Index: tests/trace.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/trace.test,v
retrieving revision 1.14
diff -u -r1.14 trace.test
--- tests/trace.test	2001/11/21 19:53:40	1.14
+++ tests/trace.test	2001/12/03 21:40:37
@@ -56,6 +56,18 @@
     global info
     set info [list $oldName $newName $op]
 }
+
+test trace-0.0 {memory corruption in trace (Tcl Bug 484339)} {
+    # You may need Purify or Electric Fence to reliably
+    # see this one fail.
+    catch {unset z}
+    trace add variable z array {set z(foo) 1 ;#}
+    set res "names: [array names z]"
+    catch {unset ::z}
+    trace variable ::z w {unset ::z; error "memory corruption";#}
+    list [catch {set ::z 1} msg] $msg
+} {1 {can't set "::z": memory corruption}}
+
 # Read-tracing on variables
 
 test trace-1.1 {trace variable reads} {
@@ -885,7 +897,7 @@
     trace add variable "x y z(a\n\{)" write traceProc
     set "x y z(a\n\{)" 33
     set info
-} "{x y z} a\\n\\{ write"
+} "{x y z} a\\n\\\{ write"
 
 # Check for proper handling of unsets during traces.