Skip to content
Tcl Source Code Artifact [ecd56ab4d3]
Login

Artifact [ecd56ab4d3]

Artifact ecd56ab4d3f2fba808f5a56df90017f554c59e2a:

Ticket change [ecd56ab4d3] - New ticket [219073ffffffffff|219073ffff] <i>[regexp -all {a*} a] loops infinitely</i>. by nobody on 2000-10-26 01:10:19.
D 2000-10-26T01:10:19
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s4981\sBug\nVersion:\s8.3\nSubmitDate:\s'2000-04-10'\nLastModified:\s'2000-04-10'\nSeverity:\sCRIT\nStatus:\sReleased\nSubmitter:\sericm\nChangedBy:\sericm\nOS:\sAll\nFixedDate:\s'2000-04-10'\nFixedInVersion:\s8.3.1\nClosedDate:\s'2000-10-25'\n\n\nBecause\sof\sthe\simplementation\sof\sregexp\s-all,\sthis\scommand:\n\nregexp\s-all\s{a*}\sa\n\nwill\sloop\sindefinately.\s\sThe\sproblem\sis\straced\sto\sthe\sregexp\scommand,\sin\swhich\sthe\sfollowing\s(essentially)\soccurs:\n\nwhile\s(1)\s{\nmatchRegexp(...offset...);\n\n...\n\noffset\s+=\smatchLength;\n}\n\nIn\sthe\scase\sof\s{a*}\sand\sthe\sstring\sa,\sthe\sregexp\swill\smatch\sthe\s{}\sat\sthe\send\sof\sthe\sstring.\s\sOf\scourse,\sthe\slength\sof\s{}\sis\s0,\sso\sthe\soffset\snever\sgets\sincremented,\sso\sthe\snext\spass\sthrough\sthe\sloop\smatches\sagainst\sthe\ssame\schunk\sof\sthe\sstring.\s\sAnd\sso\son,\sad\sinfinitum.\n\nThe\sfix\srequires\stwo\schanges:\n\n1.\s\soffset\sshould\salways\sbe\sincremented\sby\smin(1,\smatchLength)\n2.\s\safter\soffset\shas\sbeen\sincremented,\sit\sshould\sbe\stested\sto\ssee\sif\sit\sis\spast\sthe\send\sof\sthe\sstring;\sif\sso,\sthe\sloop\sshould\sterminate.\s\sthe\sregexp\smatching\sengine\shas\sthe\sinvarient\sthat\sstarting\sindices\spast\sthe\send\sof\sthe\sstring\sget\sconfined\sto\sthe\srange\sof\sthe\sstring,\sso\sspecifying\san\soffset\sof\sstringLength+1\swill\snot\scause\sit\sto\sfail\sto\smatch\s--\sit\swill\sjust\sinterpret\sthat\sas\sstringLength.\n\n-\seric\n\n\n\nFixed\sfor\s8.3.1.,\swith\stests.\n\n-\seric\n
J foundin obsolete:\s8.3
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 43.\sRegexp
J title [regexp\s-all\s{a*}\sa]\sloops\sinfinitely
J type Bug
K 219073ffffffffffffffffffffffffffffffffff
U nobody
Z 0ec847270dacbe79cd26087a3a5179d1