Skip to content
Tcl Source Code Artifact [690a60b342]
Login

Artifact [690a60b342]

Artifact 690a60b342ed05a8019f42cda3c43c19b9ced961:

Ticket change [690a60b342] - Open ticket [405998ffffffffff|405998ffff]: <i>Tcl_SetListObj fails reset obj properly</i> plus 4 other changes by dgp on 2001-03-29 10:09:11.
D 2001-03-29T10:09:11
J icomment Logged\sIn:\sYES\s\nuser_id=80530\n\nI'm\sre-opening\sthis\sand\sattaching\sa\ssmall\sC\sprogram\sthat\ndemonstrates\sthat\sthis\sbug\scan\scause\ssegfaults.\s\sI\sthink\nthe\scontributed\sfix\sshould\sbe\saccepted.\n\nIn\ssegfault.c,\safter\sTcl_SetListObj()\sreturns,\s\nobjPtr->bytes\s==\stclEmptyStringRep,\sbut\sobjPtr->length\s!=\s0.\nThen\sTcl_AppendToObj()\scalls\sSetStringFromAny()\swhich\swrites\nto\sobjPtr->bytes[objPtr->length],\sassuming\sthat\slength\shas\na\svalue\sthat\smakes\sthis\ssafe.\s\sInstead\smemory\sis\scorrupted.\n\nsegfault.c\shas\sbeen\swritten\sso\sthe\scorrupted\smemory\schanges\nthe\svalue\sof\srefArray\sin\stclPreserve.c\sso\sthe\snext\stime\nTcl_Preserve()\sis\scalled\s=>\sSIGSEGV!\n\nThis\s*could*\sbe\sfixed\swith\sa\srather\scomplicated\sfix\sto\nSetStringFromAny(),\sbut\sthe\ssimple\sfix\scontributed\shere\nis\sthe\sbetter\schoice.\s\sAlso,\severywhere\selse\sin\sthe\score\nwhen\s->bytes\sis\sassigned\sto\stclEmptyStringRep,\s->length\sis\nalso\sassigned\sto\s0,\seven\sif\s->typePtr\s==\sNULL,\snotably\sin\nTcl_NewObj().\s\sI\sdon't\ssee\sany\sreason\swhy\sTcl_SetListObj()\nshould\sbe\sexceptional.\n\n\n
J login dgp
J mimetype text/plain
J status Open
J username dgp
K 405998ffffffffffffffffffffffffffffffffff
U dgp
Z e0a6bd5cf05a01d3689683d5f5b35781