Overview
| Artifact ID: | a891720f6b8400fd5cb9c9a1980277ec4d3b53d6 |
|---|---|
| Ticket: | 568123ffffffffffffffffffffffffffffffffff
bug in Tcl_DeleteTrace function |
| User & Date: | hemanglavana on 2002-06-12 17:29:49 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
Here's the patch: Index: tclBasic.c =================================================================== RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v retrieving revision 1.58 diff -c -r1.58 tclBasic.c *** tclBasic.c 11 Jun 2002 15:42:19 -0000 1.58 --- tclBasic.c 12 Jun 2002 17:19:37 -0000 *************** *** 4970,4976 **** while ( (*tracePtr2) != NULL && (*tracePtr2) != tracePtr ) { tracePtr2 = &((*tracePtr2)->nextPtr); } ! if ( tracePtr2 == NULL ) { return; } (*tracePtr2) = (*tracePtr2)->nextPtr; --- 4970,4976 ---- while ( (*tracePtr2) != NULL && (*tracePtr2) != tracePtr ) { tracePtr2 = &((*tracePtr2)->nextPtr); } ! if ( *tracePtr2 == NULL ) { return; } (*tracePtr2) = (*tracePtr2)->nextPtr; If you examine the code carefully, tracePtr2 can never be NULL because it is assigned the address of (*tracePtr2)->nextPtr in the while loop. On the other hand, it is possible for *tracePtr2 to be NULL (this is also one of the conditions in while loop). Hence the if condition should check for *tracePtr2 == NULL instead of tracePtr2 == NULL, otherwise the following line "(*tracePtr2) = ..." can give segmentation fault. - foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "hemanglavana"
- subsystem changed to: "None"
- title changed to: "bug in Tcl_DeleteTrace function"
- type changed to: "Bug"