Skip to content
Tcl Source Code Artifact [700b71e92a]
Login

Artifact [700b71e92a]

Artifact 700b71e92a1ca1f03e32cb7365b98abb93eeffe4:

Ticket change [700b71e92a] - Ticket [3069278fffffffff|3069278fff] <i>breakage on head Windows triggered by install-tzdata</i> status still Open with 4 other changes by nijtmans on 2010-09-21 18:47:32.
D 2010-09-21T18:47:32
J icomment I\sworked\sthrough\sthe\scode,\strying\sto\sfind\slocations\swhere\sUNICODE\nstrings\swere\sappended\sto\sa\sbuffer,\strying\sto\slet\sis\send\swith\sa\sdouble\nnull-byte.\sIn\smost\splaces,\sthis\sis\sdone\sby\susing\nTcl_DStringSetLength(....\s,\slen+1);\nTcl_DStringSetLength(....\s,\slen);\nThe\sfirst\scall\sallocates\senough\sspace\sto\saccomodate\sfor\sthe\sextra\nnull\sbyte,\sThe\ssecond\scall\ssets\sthe\slength\scorrectly,\sand\sputs\nthe\sprincipal\snull-byte\sthere.\n\nHowever,\sthere\swere\stwo\splaces\swhere\sit\swas\sdone\sdifferently.\nIn\stclWinFCmd.c,\sline\s1307:\n\snativeSource[oldSourceLen\s+\s1]\s=\s'\\0';\nIf\soldSourceLen\sis\sthe\sstring\slength\sin\sbytes,\sand\nnativeSource\sis\sa\sWCHAR\sarray,\sthis\swill\sset\stwo\nnull-bytes\sin\sthe\sstring,\sbut\sat\sa\sdouble\sindex\nof\sthe\sintended\slocation.\sThe\sUNICODE\sstring\nwill\snot\sbe\snull-terminated,\swhich\sexplains\nexactly\sAndreas'\sstack\strace.\n\nAnother\slocation\swas\sat\stclWinPipe.c,\sline\s3136:\n\s*(WCHAR\s*)(namePtr\s+\sTcl_DStringLength(&buf)\s+\s1)\s=\s'\\0';\nNot\sthat\sbad,\sbut\scasting\sa\schar\s*\sto\sa\sWCHAR\s*,\swhile\nnot\seven\sbeing\ssure\sthat\sthe\spointer\sis\saligned\sto\na\stwo-byte\sboundry,\sis\sclearly\snot\scorrect.\n\nHere\sis\sthe\spatch,\swhich\schanged\sboth\slocations\sto\nuse\sthe\sdouble\sTcl_DStringSetLength\smethod.\sThis\nshould\s-\sonce\sand\sfor\sall\s-\sfix\sthis.\n\nAndreas\s\s(or\sJeff),\scould\syou\splease\sconfirm\sthat\sthis\nfixes\sthe\sbug?\sThanks!\n\nOriginally,\sI\sintended\sto\smodify\stclUtil.c\ssuch\sthat\non\sWindows\stwo\snull-bytes\sare\salways\sguaranteed.\nHowever,\sthere\sis\sa\slot\sof\scode\swhich\sassumes\ninsertion\sof\sa\ssingle\snull-byte,\sso\sthis\slead\sto\ntest\sfailures.\n
J login nijtmans
J mimetype text/plain
J username nijtmans
K 3069278fffffffffffffffffffffffffffffffff
U nijtmans
Z b850416a85c9b2c75ddef7e4aff38b45