Tcl package Thread source code

View Ticket
Login
Ticket UUID: 9ab808b6639182736ac3b7493a54726b69c2730d
Title: Segmentation fault on ::tsv::names
Type: Bug Version: 2.7.1
Submitter: anonymous Created on: 2014-11-24 16:45:59
Subsystem: 80. Thread Package Assigned To: jan.nijtmans
Priority: 9 Immediate Severity: Critical
Status: Closed Last Modified: 2014-11-25 18:37:17
Resolution: Fixed Closed By: anonymous
    Closed on: 2014-11-25 18:37:17
Description:
The following script exits due to a segmentation fault with Tcl 8.6.3 and Thread 2.7.1. This did not happen with Thread 2.7.0.

~~~
package require Thread;
::tsv::set x k v;
::tsv::names;
~~~
User Comments: anonymous (claiming to be Adrián Medraño Calvo) added on 2014-11-25 18:37:17:
Looking forward to the release, thank you for your effort!

jan.nijtmans added on 2014-11-25 16:13:18:

Fixed in trunk [f5a0464536f6bc73b0a2a0a1a19e2888eed90b6a|f5a0464536]. Fix will be in thread 2.7.2

Thanks for the report!


anonymous (claiming to be Adrián Medraño Calvo) added on 2014-11-25 15:08:57:
The following patch fixes the segmentation fault. It seems this was missing in 355cf8021c98b4bc07c9c97a5a3c74ab17d6ef52. Please, review.

diff --git i/src/tcl8.6.3/pkgs/thread2.7.1/generic/threadSvCmd.c w/src/tcl8.6.3/pkgs/thread2.7.1/generic/threadSvCm
index 1250af1..06c4d6a 100644
--- i/src/tcl8.6.3/pkgs/thread2.7.1/generic/threadSvCmd.c
+++ w/src/tcl8.6.3/pkgs/thread2.7.1/generic/threadSvCmd.c
@@ -1505,6 +1505,7 @@ SvNamesObjCmd(
         LOCK_BUCKET(bucketPtr);
         hPtr = Tcl_FirstHashEntry(&bucketPtr->arrays, &search);
         while (hPtr) {
+            svObj = (Container*)Tcl_GetHashValue(hPtr);
             char *key = Tcl_GetHashKey(&bucketPtr->arrays, hPtr);
             if ((!svObj->aolSpecial || (*key != '.')) /* Hide .<name> arrays for AOL*/ &&
                 (pattern == NULL || Tcl_StringMatch(key, pattern))) {