diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2004-09-03 18:11:59 (GMT) |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2004-09-03 18:11:59 (GMT) |
commit | 0506c64086e2535335a58b9368d2b940abbf8c11 (patch) | |
tree | 44cdb5b7978f1452156df79ed0b0bbf3b1f13fc8 /Modules | |
parent | a01a2ee933238dbd3e79bc3b07cfb703d40807a8 (diff) | |
download | cpython-0506c64086e2535335a58b9368d2b940abbf8c11.zip cpython-0506c64086e2535335a58b9368d2b940abbf8c11.tar.gz cpython-0506c64086e2535335a58b9368d2b940abbf8c11.tar.bz2 |
Fixing bug #817234, which made SRE get into an infinite loop on
empty final matches with finditer(). New test cases included
for this bug and for #581080.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sre.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 4be33d0..1614224 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -539,7 +539,7 @@ SRE_COUNT(SRE_STATE* state, SRE_CODE* pattern, int maxcount) break; case SRE_OP_ANY_ALL: - /* repeated dot wildcare. skip to the end of the target + /* repeated dot wildcard. skip to the end of the target string, and backtrack from there */ TRACE(("|%p|%p|COUNT ANY_ALL\n", pattern, ptr)); ptr = end; @@ -3244,8 +3244,7 @@ scanner_match(ScannerObject* self, PyObject* args) match = pattern_new_match((PatternObject*) self->pattern, state, status); - if ((status == 0 || state->ptr == state->start) && - state->ptr < state->end) + if (status == 0 || state->ptr == state->start) state->start = (void*) ((char*) state->ptr + state->charsize); else state->start = state->ptr; @@ -3276,8 +3275,7 @@ scanner_search(ScannerObject* self, PyObject* args) match = pattern_new_match((PatternObject*) self->pattern, state, status); - if ((status == 0 || state->ptr == state->start) && - state->ptr < state->end) + if (status == 0 || state->ptr == state->start) state->start = (void*) ((char*) state->ptr + state->charsize); else state->start = state->ptr; |