Artifacts Associated With Ticket 1810038
Ticket change [d34a08c2bd] (rid 123267) by mmaslano on 2007-10-09 09:24:13:
- assignee initialized to: "pvgoran"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Occure in version: 8.0 and higher, I try it also in devel version 8.5b1 and the problem is still here. Reproducer: TCL version: regexp '($|^X)*' 'foo' The problem is in regular expressions code, which results in a non-terminating infinite loop during nondeterministic finite automata optimization. These loops remain even after the client disconnects and can be used to hog CPU and connections to the database until a full-fledged denial of service condition occurs. I try to attach patch soon, but at the moment I've no idea, where in code is the problem.
- foundin initialized to: "obsolete: 8.5b1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "mmaslano"
- subsystem initialized to: "43. Regexp"
- title initialized to: "DoS via infinite loop in regex NFA optimization"
- type initialized to: "Bug"
Ticket change [fff9d27d4d] (rid 108852) by hobbs on 2007-10-10 01:19:49:
- is_private changed to: "1"
- priority changed to: "9 Immediate"
Ticket change [876acea644] (rid 131692) by dgp on 2007-11-06 04:29:42:
- icomment:
Logged In: YES user_id=80530 Originator: NO Just to correct the report, this bug does not appear in Tcl 8.0.5: % info patch 8.0.5 % regexp ($|^X)* foo couldn't compile regular expression pattern: *+ operand could be empty The reported bug arrived in Tcl 8.1.0 with the new regexp engine.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [ca14bbe7a1] (rid 122401) by dgp on 2007-11-06 23:35:21:
- icomment:
Logged In: YES user_id=80530 Originator: NO Things get stuck in the do {...} while () loop inside the pullback() routine at about line 750 in regc_nfa.c . The stuck loop starts with nfa->nstates == 12 and each iteration adds 2 to nfa->nstates, and sets progress to 1. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [fee3ae6000] (rid 108663) by dgp on 2007-11-07 00:42:01:
- icomment:
Logged In: YES user_id=80530 Originator: NO Enabling the dumpnfa(), here's the first few iterations: Original: pre 1, post 0, bos [2], bol [3], eos [4], eol [5] 0@ no out arcs 1> ^0->4 ^1->4 [1]->4 [0]->4 4. $0->0 $1->0 [1]->0 [0]->0 ^1->10 $1->4 10. [1]->4 After first loop: pre 1, post 0, bos [2], bol [3], eos [4], eol [5] 0@ no out arcs 1> ^0->4 ^1->4 [1]->4 [0]->4 ^1->10 4. $0->0 $1->0 [1]->0 [0]->0 $1->4 ^1->13 10. [1]->4 13. $1->10 After second loop: 0@ no out arcs 1> ^0->4 ^1->4 [1]->4 [0]->4 ^1->10 ^1->13 4. $0->0 $1->0 [1]->0 [0]->0 $1->4 ^1->15 10. [1]->4 13. $1->10 15. $1->13 ...and the pattern continues. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [f8007b755e] (rid 91465) by dgp on 2007-11-07 03:01:16:
- icomment:
Logged In: YES user_id=80530 Originator: NO Slightly simpler test that still demos the problem: % regexp ($|^)* {} - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [e2b331fe7f] (rid 87675) by dgp on 2007-11-09 01:05:28:
- icomment:
Logged In: YES user_id=80530 Originator: NO Possibly useful observations... Changing the parens from capturing to non-capturing stops the infinite loop in the simplified test... % regexp (?:$|^)* {} 1 ...but not in the original test... % regexp (?:$|^X)* {} <hangs> - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "1810038.patch" [8e73d95aa5] (rid 120110) by dgp on 2007-11-16 04:32:23.
Ticket change [d538bb7180] (rid 123584) by dgp on 2007-11-16 04:32:24:
- icomment:
File Added - 254493: 1810038.patch Logged In: YES user_id=80530 Originator: NO Attached patch (for HEAD) is a fix. File Added: 1810038.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [a34ba63596] (rid 110025) by dgp on 2007-11-16 05:01:36:
- assignee changed to: "dgp"
- closedate changed to: "2007-11-15T22:01:36"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 Originator: NO Fix committed to both branches.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dgp"
Ticket change [1ba8c204c9] (rid 123188) by dkf on 2007-12-02 03:49:57:
- is_private changed to: "0"