<i>core dump on Linux while [read]ing file</i> status still Open with 5 other changes
by
.
D 2006-04-04T06:31:54
J icomment Logged\sIn:\sYES\s\nuser_id=75003\n\nOk.\sI\sknow\swhere\sthe\sproblem\sis,\sand\sI\shave\sfix\ssitting\sin\nmy\ssandbox.\sI\shave\sno\soriginal,\sso\sno\spatches,\sand\ncommitting\sthe\sfix\shas\sto\swait\sfor\sSF\sget\stheir\sact\stogether\nand\sCVS\sback\srunning.\n\nStory\stime:\n\n(a)\sReadChars\sis\scalled\swith\sa\sbuffer\scontaining\sone\sbyte.\n\s\s\s\sThis\sbuffer\shas\sno\ssuccessor\s(end-of-input-queue\sEOIQ).\n(b)\sThe\sTcl_ExternalToUtf\sin\sReadChars\ssignals\sa\ssplit\n\s\s\s\smulti-byte\scharacter.\sBecause\sof\sEOIQ\sReadChars\ssignals\n\s\s\s'nothing\sread'\sand\s'channel_need_more_data'\n(c)\sThe\sIO\slayer\sdoes\sits\sthing,\sreading\smore\sdata.\n\s\s\s\sThis\sdetects\sEOF,\sand\ssets\sTCL_ENCODING_END.\n(d)\sReadChars\sis\scalled\sagain.\n\s\s\s\sIt\snow\shas\stwo\sbuffers.\sOne\swith\ssplit\smulti-byte\sat\sthe\n\s\s\s\send,\sa\ssecond\swith\sthe\sremainder\sof\sthe\smulti-byte\schar.\n\s\s\s\sIt\stries\sto\sconvert\sthe\sfirst\sbuffer\sagain.\n\s\s\s\sThis\ssuceeds!!\sbecause\sof\sthe\sTCL_ENCODING_END.\n\n\s\s\s\sThis\sis\swrong.\sIt\sshould\snot\shave\ssuceeded,\sbut\sfailed\n\s\s\s\sas\sbefore.\sThen\scausing\sReadChars\sto\scopy\sthe\spartial\n\s\s\s\smulti-byte\schar\sto\sthe\sbeginning\sof\sthe\snow\sexisting\n\s\s\s\snext\sbuffer.\sAnd\sthen\stry\sagain,\swith\sthe\smodified\n\s\s\s\sinput\squeue.\n\nIn\sessence\sthe\sTCL_ENCODING_END\sis\shanded\sto\sthe\nTcl_ExternalToUtf\stoo\searly.\sYes,\sthere\sis\san\sEOF\spending,\nbut\sright\snow\swe\shave\stwo\sbuffers\sin\sthe\squeue,\sso\sthe\sfirst\none\scannot\sbe\sthe\send.\n\nThere\sis\sa\scontributing\sbug\shidden\sin\sthe\sabove\sdescription:\nTcl_ExternalToUtf,\si.e.\sTcl_Utf2UtfProc\sis\saccessing\smemory\nbehind\sthe\send\sof\sits\sinput\sbuffer\sif\sthe\slast\scharacter\sis\nthe\sstart\sof\sa\smulti-byte\scharacter\sand\sTEE\sis\sset.\n\nAnd\sin\sthis\scase\sthe\scharacter\sfound\sthere\swas\sa\svalid\ncompletion\sof\sthe\smulti-byte\sheader,\sso\sit\sconsumed\s2\sbytes\nand\sreported\sthat,\sstarting\sthe\supper\slayers\sto\spsiral\sout\nof\scontrol.\sHere\sthe\smemory\slayout\scomes\sinto\splay,\scausing\nthe\shigh\ssensitivity\sagainst\sany\stype\sof\schange,\sbe\sit\ndifferent\sbuffer\ssizes\sor\seven\sa\sswitch\sto\snon-interactive\noperation.\sIn\smost\scases\sthe\sbyte\sread\sis\snot\sa\svalid\ncompletion\sof\sthe\smulti-byte\schar,\sso\sonly\sone\sbyte\sis\nconsumed\s(as\spart\sof\screating\scanonical\sutf-8\sfrom\sthe\nnon-canonical\sinput)\sand\sthat\skeeps\sthe\supper\slayers\sstable\nand\shappy.\sThe\sread\sinformation\sis\sbad,\sa\smulti-byte\schar\nwas\sbroken,\sbut\sno\scrash.\n\nThis\sbug\shas\sbeen\sfixed\sas\swell.\sA\squick\stest\swith\svalgrind\nconfirmed\sthis\sbad\smemory\saccess\sbtw.\s(using\sa\sslightly\nmodified\smake\svalgrind\starget).\n\nThe\swhole\sproblem\sis\slikely\spresent\sin\s8.5\sas\swell.\sFixes\nwill\sdone\stomorrow.\sThis\stook\sthe\swhole\sday\sto\sfully\strace\nin\sits\sentirety.\n
J login andreas_kupries
J mimetype text/plain
J resolution Fixed
J username andreas_kupries
K 1462248fffffffffffffffffffffffffffffffff
U andreas_kupries
Z 325b2576e251b220c873ba5b287a5123