<i>tcltest errors on io.test module and others</i> status still Open with 6 other changes
by
.
D 2000-11-20T14:15:39
J icomment The\slog\scontains\sseveral\splaces\sthe\scompiler\swarns\sabout.\sThey\sare\nhandled\shere\sseparately.\n\nThere\sare\sonly\sfour\sdistinct\smessages,\scalled\sA-D.\n\nUpfront\ssummary\n___________________________________________________\n(A)\sPriority\s8,\sopen, \smay\scause\scrashes\n(B)\sPriority\s2,\sclosed,\sno\sremedy\sshort\sof\srewriting\sthe\swhole\sbuffer\ssystem.\n(C)\sPriority\s2,\sclosed,\salready\sfixed\s(8.4a2)\n(D)\sPriority\s4,\sclosed,\slook\sfor\sother\sreports\sregarding\sdefinition\sof\s'size_t'\n\n___________________________________________________\n(A)cc:\sInfo:\s./../generic/tclEncoding.c,\sline\s1337:\sIn\sthis\nstatement,\san\sarray\ssub\sscript\sexpression\sis\seither\nless\sthan\szero\sor\sgreater\sthan\sthe\slargest\svalue\sthat\ncan\sbe\srepresented\sby\sthe\ssize_t\stype.\s(badsubscript)\n \shex\s=\sstaticHex\s-\s'0';\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThe\scode\sin\squestion\sis\n\n \schar\s*hex;\n \sstatic\schar\sstaticHex[]\s=\s{\n0,\s1,\s2,\s3,\s4,\s5,\s6,\s7,\s8,\s9,\s0,\s0,\s0,\s0,\s0,\s0,\s0,\n10,\s11,\s12,\s13,\s14,\s15\n \s};\n\n>> \shex\s=\sstaticHex\s-\s'0';\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nComments:\n\n--staticHex\sdeclares\sa\smapping\sfrom\sthe\scharacters\s'0'\nupto\s'F'\s(ASCII)\sinto\sthe\scorresponding\s4bit-value\n(nibble).\n\nThe\sflagged\sstatement\sextends\sthis\srestricted\smapping\ninto\sa\smapping\sfrom\s0x00\supto\s0xFF.\n\nThe\svirtual\sarray\screated\sthiss\sway\sis\slater\s(line\n1384ff)\saccessed\svia\n\nTcl_ReadChars(chan,\sobjPtr,\s3\s+\s16\s*\s(16\s*\s4\s+\s1),\s0);\np\s=\sTcl_GetString(objPtr);\n[x]hi\s=\s(hex[(int)p[0]]\s<<\s4)\s+\shex[(int)p[1]];\n[/]dataPtr->toUnicode[hi]\s=\spageMemPtr;\n\nto\sconvert\sa\s2-character\shex\ssequence\sinto\sthe\ncorresponding\sbyte\svalue.\sThe\sfollowing\sloop\sdoes\sthe\nsame.\n\n--This\scode\sis\sextremely\sunsafe\swith\srespect\sto\sthe\ncontents\sof\sthe\sfile\scontaining\sthe\sencoding.\sIt\nassumes\sthat\sencoding\sfiles\salways\sfollow\sthe\nrules.\sGarbage,\si.e.\snon-hex\scharacters\swill\scause\sthe\ninterpreter\sto\scrash,\seither\sin\s[x]\sbecause\s'hex'\sis\naccessed\soutside\sof\sthe\svalid\srange\s(=\sstaticHex),\sor\nin\s[/]\sbecause\sthe\scomputed\svalue\sof\s'hi'\sis\soutside\nof\sthe\sbounds\sof\sthe\sarray\s'toUnicode'.\sThe\ncorresponding\sstatements\sin\sthe\sloop\smay\scause\sthat\ntoo.\n\nBecause\sof\sthis\sunsafety\sthe\sbug\snow\shas\spriority\s8.\n\n\n--I\sspeculate\sthat\sthe\scode\swas\swritten\sthis\sway\sto\nenhance\sthe\sperformance\sof\sthe\sconversion\sby\sremoving\nthe\sneed\sto\ssubtract\s'0'\sfrom\severy\scharacter\sused\sto\nindex\sthe\sarray.\n\nProposed\ssolution:\n\n1)Remove\sthe\svirtual\sarray\sand\sindex\sinto\s'staticHex'\ndirectly\sinstead,\ssubtract\s'0'\sfrom\seach\scharacter\nused\sto\sdo\sso.\n\n2)Additional\schecks\sto\sensure\sthat\sthe\scharacters\sused\nto\sindex\sinto\s'staticHex'\sare\sin\sthe\srange\s'0'\s...\s'F'\n(or\s'0'\s...\s'9'\sand\s'A'\s...\s'F').\sReturn\sNULL\sif\sthese\nchecks\strigger.\sThis\sis\salready\sthe\svalue\sto\sbe\sused\nto\ssignal\san\sinvalid\sencodiing\sfile.\n\n___________________________________________________\n(B)cc:\sInfo:\s./../generic/tclIO.c,\sline\s3535:\sIn\sthis\sstatement,\nan\sarray\sis\sbeing\saccessed\soutside\sthe\sbounds\sspecified\sfor\nthe\sarray\stype. \s(subscrbounds)\n\n \smemcpy((VOID\s*)\s(nextPtr->buf\s+\sBUFFER_PADDING\s-\sextra),\n \s--------------------------------^\n\n\ncc:\sInfo:\s./../generic/tclIO.c,\sline\s3683:\sIn\sthis\sstatement,\nan\sarray\sis\sbeing\saccessed\soutside\sthe\sbounds\sspecified\sfor\nthe\sarray\stype. \s(subscrbounds)\n\n(VOID\s*)\s(nextPtr->buf\s+\sBUFFER_PADDING\s-\sextra),\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nIn\s8.4a2\sthe\scode\sin\squestion\shas\smoved\sto\sline\s3637.\n\n \sextra\s=\srawLen\s-\sgsPtr->rawRead;\n>> \smemcpy((VOID\s*)\s(nextPtr->buf\s+\sBUFFER_PADDING\s-\sextra),\n \s(VOID\s*)\s(raw\s+\sgsPtr->rawRead),\s(size_t)\sextra);\n \snextPtr->nextRemoved\s-=\sextra;\n \sbufPtr->nextAdded\s-=\sextra;\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nComments:\n\n--'bufPtr'\sis\sof\stype\s'ChannelBuffer*'.\sThe\sstructure\sis\ndefined\sas\n\ntypedef\sstruct\sChannelBuffer\s{\n...\ssome\sfields\somitted\n \schar\sbuf[4];/*\sPlaceholder\sfor\sreal\sbuffer.\sThe\sreal\n \s*\sbuffer\soccuppies\sthis\sspace\s+\sbufSize-4\n \s*\sbytes.\sThis\smust\sbe\sthe\slast\sfield\sin\n \s*\sthe\sstructure.\s*/\n}\sChannelBuffer;\n\nThe\ssystem\semploys\sa\scommon\strick:\sThe\sstructure\ndefined\shere\sdeclares\sjust\sthe\shead\sof\sthe\sbuffer.\sIn\nthe\smemory\sthe\sdata\sin\sthe\sbuffer\sis\sappended\nimmediately\sbehind\sthis\shead,\sand\sthe\s'buf'\sfield\ngives\sus\san\seasy\sto\scompute\sreference\sto\sit\s(The\ncompiler\sdoes\sit\sfor\sus,\sno\sneed\sto\sdo\sthe\spointer\narithmetics\sby\sourselves).\n\n--The\sabove\smeans\sthat\sthe\swarning\sby\sthe\scompiler\sis\ncorrect,\sthe\sarray\s'buf'\sis\saccessed\soutside\sof\sthe\ndeclared\sbounds.\sStill\sthe\saccess\sis\scorrect\sand\nnothing\scan\sbe\sdone\s(except\sto\scompletely\srewrite\sthe\nbuffering\ssystem).\n\nThis\spart\sof\sthe\sbug\sis\sclosed.\n\n___________________________________________________\n(C)cc:\sWarning:\s./../generic/tclIOGT.c,\sline\s174:\sThe\nredefinition\sof\sthe\smacro\s"DELAY"\sconflicts\swith\sa\scurrent\ndefinition\sbecause\sone\sis\sobject-like\sand\sthe\sother\sis\nfunction-like. \sThe\sredefinition\sis\snow\sin\neffect.\s(macroredef)\n\n \s#define\sDELAY\s(5)\n \s--------------^\n\nComments:\n\n--This\spart\sis\spriority\s2,\sbut\seasy\sto\sfix.\nThis\spart\sis\salso\salready\sfixed\sin\s8.4a2\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n/*\n*\sNumber\sof\smilliseconds\sto\swait\sbefore\sfiring\san\sevent\sto\sflush\n*\sout\sinformation\swaiting\sin\sbuffers\s(fileevent\ssupport).\n*/\n\n#define\sFLUSH_DELAY\s(5)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n___________________________________________________\n(D)cc:\sWarning:\s./../generic/tclIOSock.c,\sline\s100:\sIn\sthis\nstatement,\sthe\sreferenced\stype\sof\sthe\spointer\svalue\s"&len"\sis\n"unsigned\slong",\swhich\sis\snot\scompatible\swith\s"int".\s(ptrmismatch)\n\n \sgetsockopt(sock,\sSOL_SOCKET,\sSO_SNDBUF,\s(char\s*)¤t,\s&len);\n \s---------^\n\ncc:\sWarning:\s./../generic/tclIOSock.c,\sline\s106:\sIn\sthis\nstatement,\sthe\sreferenced\stype\sof\sthe\spointer\svalue\s"&len"\sis\n"unsigned\slong",\swhich\sis\snot\scompatible\swith\s"int".\s(ptrmismatch)\n\n \sgetsockopt(sock,\sSOL_SOCKET,\sSO_RCVBUF,\s(char\s*)¤t,\s&len);\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \s/*\n \s*\sShould\sbe\ssocklen_t,\sbut\sHP10.20\s(g)cc\schokes\n \s*/\n \ssize_t\slen;\n\n\n \slen\s=\ssizeof(int);\n \sgetsockopt(sock,\sSOL_SOCKET,\sSO_SNDBUF,\s(char\s*)¤t,\s&len);\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nComments\n\n--The\sproblem\sis\sacknowledged\sin\sthe\scode.\nI\scurrently\ssee\sno\sway\sto\sremedy\sthis.\nGiven\sthe\splatform\sthe\sbug\sis\sreported\sfor\n(Tru64\sUnix\sV5.0a,\sAlphaserver\s8400)\sthis\sis\slikely\sa\n64bit\sissue.\n\n
J login andreas_kupries
J mimetype text/plain
J priority 8
J subsystem 57.\szlib
J username andreas_kupries
K 219417ffffffffffffffffffffffffffffffffff
U andreas_kupries
Z 7e5fc1382294bd03d0d8f876dd816cda