diff options
author | Guido van Rossum <guido@python.org> | 2008-09-10 14:27:00 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2008-09-10 14:27:00 (GMT) |
commit | e3c4fd9cc04148e16dad3ca06af65008f2e73fe3 (patch) | |
tree | 753835c1736690ef88b3d07125267c3db2944ccb /Modules | |
parent | 24329ba1762688f78ff589d0243683c4afafe096 (diff) | |
download | cpython-e3c4fd9cc04148e16dad3ca06af65008f2e73fe3.zip cpython-e3c4fd9cc04148e16dad3ca06af65008f2e73fe3.tar.gz cpython-e3c4fd9cc04148e16dad3ca06af65008f2e73fe3.tar.bz2 |
- Issue #3629: Fix sre "bytecode" validator for an end case.
Reviewed by Amaury.
Diffstat (limited to 'Modules')
-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 9111921..1aea53b 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2781,17 +2781,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) @@ -3098,7 +3099,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: |