Skip to content
Tcl Source Code View Ticket
Login

View Ticket

invalid read getting command in trace

Closed / Fixed2979402fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2010-03-30 13:47:52
Valgrind reports during the test suite:

---- trace-34.5 start
==26379== Invalid read of size 4
==26379==    at 0x8093958: Tcl_GetCommandFromObj (tclObj.c:4141)
==26379==    by 0x808FAF4: NamespaceWhichCmd (tclNamesp.c:4622)
==26379==    by 0x808D53B: TclNRNamespaceObjCmd (tclNamesp.c:2910)
==26379==    by 0x80F2D80: NRRunObjProc (tclBasic.c:4347)
==26379==    by 0x80F2B6C: TclNRRunCallbacks (tclBasic.c:4294)
==26379==    by 0x816A564: TclExecuteByteCode (tclExecute.c:2807)
==26379==    by 0x80F2E18: NRCallTEBC (tclBasic.c:4370)
==26379==    by 0x80F2B6C: TclNRRunCallbacks (tclBasic.c:4294)
==26379==  Address 0x4116B58 is 80 bytes inside a block of size 272 free'd
==26379==    at 0x4004FDA: free (vg_replace_malloc.c:233)
==26379==    by 0x819AF6F: TclpFree (tclAlloc.c:731)
==26379==    by 0x80FE200: Tcl_Free (tclCkalloc.c:1207)
==26379==    by 0x808B375: NamespaceFree (tclNamesp.c:1193)
==26379==    by 0x808B01B: Tcl_DeleteNamespace (tclNamesp.c:985)
==26379==    by 0x808DFC1: NamespaceDeleteCmd (tclNamesp.c:3259)
==26379==    by 0x808D2E9: TclNRNamespaceObjCmd (tclNamesp.c:2880)
==26379==    by 0x80F2D80: NRRunObjProc (tclBasic.c:4347)
++++ trace-34.5 PASSED
dgpplain2010-03-30 23:03:40
Trouble is in reading "cmdPtr->nsPtr->interp"
which suggests to me that cmdPtr->nsPtr is
pointing into freed memory.
dgpplain2010-03-30 23:20:21
Re-ordering the tests appears to be
the answer.  Check for CMD_IS_DELETED
before trying to read *(cmdPtr->nsPtr).
dgpplain2010-03-30 23:32:00
allow_comments - 1

fixed for 8.5.9 and 8.6b2
Log in (anonymous is fine) to add a comment.