diff options
author | Guido van Rossum <guido@python.org> | 2008-09-10 14:30:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2008-09-10 14:30:50 (GMT) |
commit | 92f8f3e013ccb5bb94b1c6133b9b226590587dba (patch) | |
tree | f6800409065a7192cd702ee161a0b4a5a7fedeb6 /Modules/_sre.c | |
parent | 93cbca33f2ab8dd8ed0f8582d94ed1a65fd137a4 (diff) | |
download | cpython-92f8f3e013ccb5bb94b1c6133b9b226590587dba.zip cpython-92f8f3e013ccb5bb94b1c6133b9b226590587dba.tar.gz cpython-92f8f3e013ccb5bb94b1c6133b9b226590587dba.tar.bz2 |
Merged revisions 66364 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66364 | guido.van.rossum | 2008-09-10 07:27:00 -0700 (Wed, 10 Sep 2008) | 3 lines
Issue #3629: Fix sre "bytecode" validator for an end case.
Reviewed by Amaury.
........
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r-- | Modules/_sre.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 2a54d8e..823dc50 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2780,17 +2780,18 @@ _compile(PyObject* self_, PyObject* args) arg = *code++; \ VTRACE(("%lu (arg)\n", (unsigned long)arg)); \ } while (0) -#define GET_SKIP \ +#define GET_SKIP_ADJ(adj) \ do { \ VTRACE(("%p= ", code)); \ if (code >= end) FAIL; \ skip = *code; \ VTRACE(("%lu (skip to %p)\n", \ (unsigned long)skip, code+skip)); \ - if (code+skip < code || code+skip > end) \ + if (code+skip-adj < code || code+skip-adj > end)\ FAIL; \ code++; \ } while (0) +#define GET_SKIP GET_SKIP_ADJ(0) static int _validate_charset(SRE_CODE *code, SRE_CODE *end) @@ -3097,7 +3098,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups) GET_ARG; if (arg >= groups) FAIL; - GET_SKIP; + GET_SKIP_ADJ(1); code--; /* The skip is relative to the first arg! */ /* There are two possibilities here: if there is both a 'then' part and an 'else' part, the generated code looks like: |