Overview
| Artifact ID: | 509841d50bc0dc69ee4c7b3ca3b7319b840c12eb |
|---|---|
| Ticket: | 505048ffffffffffffffffffffffffffffffffff
impossible occurs! |
| User & Date: | mistachkin on 2003-05-10 20:10:15 |
Changes
- icomment:
Logged In: YES user_id=113501 After further research, I have uncovered the following information: In file regexec.c on line #281, there is the following code: close = shortest(v, s, v->start, v->start, v->stop, &cold, (int *)NULL); This call is not producing the correct result for this "buggy" regexp. I came to this conclusion after I was able to obtain the correct result by manually setting the loop start variable begin to the value of v->start. As we can see here, "begin" gets it's initial value from the variable "open", which gets it's initial value from the variable "cold", which is set by function "shortest" prior to the loop. The following attempts to illustrate the flow of this very important value: cold = NULL; close = shortest(v, s, v->start, v->start, v->stop, &cold, (int *)NULL); <more code here> open = cold; cold = NULL; <more code here> for (begin = open; begin <= close; begin++) { <more code here> <this loop is extremely sensitive to the starting value of "begin"> } Further analysis reveals the reason why the variable "cold" is getting an invalid value (off by one "character", which is actually 2 bytes). This is due to function "shortest" calling function "lastcold", which iterates through the "d- >ssets" array looking for a NOPROGRESS flag. I believe this is the root cause of the problem, the NOPROGRESS flag is being set on d->sset[2] incorrectly, specifically in the "miss" function called (quite a few times) by: find --> shortest --> miss The interesting thing about this is that it appears to be a very fancy off-by-one error. It may be worthwhile to further analyze the differences between "{^blah}" and "{\Ablah}" to understand why the NOPROGRESS flag is being set incorrectly. - login: "mistachkin"
- mimetype: "text/plain"
- username: "mistachkin"