<i>uninitialized value in format-2.18</i> status still Closed with 4 other changes
by
.
D 2023-03-08T19:31:51.730
J closedate 2460012.31379317
J icomment \r\nIn\stest\sformat-2.19\sthe\saccess\sto\suninitialized\smemory\shappens\r\nwhen\sgenerating\sthe\sstring\srep\sof\sthe\sargument\s"%s\\uDE02".\s\sThe\r\nfirst\stwo\scharacters\sare\swritten\sas\ssingle-byte\sencoded\sUTF-8\r\ninto\sdst.\s\sThen\sthe\sthird\scharacter\sneeds\sto\sbe\swritten\sstarting\r\nat\sthe\s3rd\sbyte\sof\sthe\sstring\srep.\s\sSince\sthe\scharacter\sU+DE02\r\nis\sa\slow\ssurrogate,\sit\sreads\sthe\s3rd\sand\s4th\sbyte\sto\scheck\sfor\r\nresidue\sof\sa\shigh\ssurrogate,\sbut\sthose\sbytes\sare\suninitialized.\r\n\r\nMoving\sthe\sinitialization\sto\s\\0\sinside\sthe\sloop\sdisrupts\sthe\r\nsurrogate\shistory\smechanism,\sso\sthat's\snot\san\sanswer.\r\n\r\nMaybe\sa\sconditional\sinitialization\sis\spossible,\sbut\sgetting\sreally\r\nmessy\swith\scallers\sof\sTcl_UniCharToUtf()\sburdened\swith\sa\slot\r\nof\sspecialized\sknowledge\sto\smake\sthe\scall\sin\sways\sthat\sreliably\r\navoid\sthis\sissue.
J login dgp
J mimetype text/plain
K f3cb2a32d60cf1386b08497b85434cf0177e7c6d
U dgp
Z 51326a1e49c54f02ba77b71659ddef59