.
D 2015-10-17T03:38:02.437
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment There\sare\svarious\sways\sto\sdrive\sthe\sregexp\scode\sinto\sstack\soverflow.\s\sAn\sexample\sis\sthat\r\n\r\nregexp\s{(^$)+}\s{z}\r\n\r\nwill\scause\sa\sstack\soverrun\sin\smarkreachable()\sin\s8.6.4.\s\s(On\smy\sx86_64\smachine,\sif\sI\sset\s"ulimit\s-s\s1024"\sit\stakes\sabout\s4\sminutes\sto\sget\sto\sthis\spoint,\sbut\sit\swill\sget\sthere.)\s\sI\sbelieve\sthis\sis\sdriven\sby\sthe\sproblem\sdiscussed\sin\shttp://core.tcl.tk/tcl/tktview?name=8f245009b0\swhich\sI\splan\sto\ssubmit\sa\sfix\sfor,\sbut\sthe\spoint\sthat\sconcerns\sme\sright\snow\sis\sthat\sthere\sare\smultiple\splaces\sthat\srecurse\sto\sa\sdepth\slimited\sonly\sby\sthe\ssize\sof\sthe\sregexp\sNFA,\sand\sif\syou\sdon't\shave\slots\sof\sstack\sspace\syou\sare\sgoing\sto\sget\sa\sSIGSEGV\son\sstack\soverflow.\r\n\r\nThe\sPostgres\sproject\shas\sdecided\sto\sdeal\swith\sthis\shazard\sby\suniformly\sinstalling\sstack\soverflow\schecks\sin\sall\srecursive\sfunctions\sin\sthe\sregex\scode;\ssee\r\nhttp://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b63fc28776c5d2efdb4de326ad0f0b5b88f82220\r\n\r\nI\swould\slike\sto\ssubmit\sa\sTcl-adapted\sversion\sof\sthat\spatch,\sbut\sI\sdo\snot\sknow\swhat\simplementation\stechnology\swould\sbe\sconsidered\sacceptable,\sso\sthe\spoint\sof\sthis\sbug\sreport\sis\sto\sask.\r\n\r\nI\ssee\sthat\syou\sguys\spreviously\snoted\sthe\spossibility\sof\sstack\soverrun\sin\sduptraverse()\sand\sfixed\sit\swith\sa\shard-wired\srecursion\sdepth\scount\slimit.\s\sThat\sanswer\sdoesn't\sseem\stoo\sappealing\sto\sme:\sit\scomplicates\sthe\sfunction's\sAPI\sand\sit's\svery\sunclear\swhat\snumber\sto\suse\sfor\sthe\slimit.\s\sSo\spropagating\sthe\ssame\smethodology\sinto\sa\sdozen\sother\splaces\sis\snot\sattractive.\r\n\r\nThe\stechnology\sPostgres\sis\susing\sdepends\son\smeasuring\sthe\sdistance\sfrom\sa\sfunction's\slocal\svariables\sto\sa\sstack\sbase\spointer\sestablished\sat\sexecution\sstartup.\s\sI\sdo\snot\ssee\show\swe\scan\suse\sthat\sexact\sapproach\sin\sTcl,\ssince\sTcl\sis\sfundamentally\sa\slibrary\snot\san\sapplication\sand\scan't\srun\sat\sexecution\sstart;\sbut\sI\swonder\sif\sit\swould\sbe\sokay\sto\sdecree\sthat\swe'll\sallow\sa\smaximum\sstack\sdepth\sof\sso-and-so-many\skilobytes\smeasured\sfrom\sthe\sentry\sto\sregcomp()\sor\sregexec()\srespectively.\s\sThat\scould\sbe\smechanized\sby\staking\sthe\saddress\sof\sthe\s"struct\svars"\sstruct\sas\sbeing\sthe\smeasurement\sreference.\r\n\r\nComments\sor\sbetter\sideas\sappreciated.
J foundin 8.6.4
J is_private 0
J login tgl
J priority 5\sMedium
J private_contact 26864b65f1c6ce8bda86f87ed9c554e19ac0390d
J resolution None
J severity Important
J status Open
J submitter tgl
J subsystem 43.\sRegexp
J title Stack\soverruns\sin\sregexp\scode
J type Bug
K 7d47ba7d9497fda88c064b6152d3a2126c3cd9d2
U tgl
Z e168f16db3f345a8d3acbef1a8234013