summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-08-03 16:22:28 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-08-03 16:22:28 (GMT)
commitb94f61b6fb4cd36aa1bcb0b7636c65ca0a04019d (patch)
tree3337c0acf60d6234220526b4b5cb6dd13dff71b1 /Modules/_sre.c
parentfb0ffa12fc79dfa4f97a61d9c32995551f995c1d (diff)
parent1f35ae0a3c7dc2d7709f60e62cb4d0aa7aeae490 (diff)
downloadcpython-b94f61b6fb4cd36aa1bcb0b7636c65ca0a04019d.zip
cpython-b94f61b6fb4cd36aa1bcb0b7636c65ca0a04019d.tar.gz
cpython-b94f61b6fb4cd36aa1bcb0b7636c65ca0a04019d.tar.bz2
Issue #17998: Fix an internal error in regular expression engine.
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 9b49951..a6933e8 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -997,7 +997,7 @@ entrance:
TRACE(("|%p|%p|REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr,
ctx->pattern[1], ctx->pattern[2]));
- if (ctx->pattern[1] > (end - ctx->ptr) / state->charsize)
+ if ((Py_ssize_t) ctx->pattern[1] > (end - ctx->ptr) / state->charsize)
RETURN_FAILURE; /* cannot match */
state->ptr = ctx->ptr;
@@ -1081,7 +1081,7 @@ entrance:
TRACE(("|%p|%p|MIN_REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr,
ctx->pattern[1], ctx->pattern[2]));
- if (ctx->pattern[1] > (end - ctx->ptr) / state->charsize)
+ if ((Py_ssize_t) ctx->pattern[1] > (end - ctx->ptr) / state->charsize)
RETURN_FAILURE; /* cannot match */
state->ptr = ctx->ptr;
@@ -1180,7 +1180,7 @@ entrance:
TRACE(("|%p|%p|MAX_UNTIL %d\n", ctx->pattern,
ctx->ptr, ctx->count));
- if (ctx->count < ctx->u.rep->pattern[1]) {
+ if (ctx->count < (Py_ssize_t) ctx->u.rep->pattern[1]) {
/* not enough matches */
ctx->u.rep->count = ctx->count;
DO_JUMP(JUMP_MAX_UNTIL_1, jump_max_until_1,
@@ -1194,7 +1194,7 @@ entrance:
RETURN_FAILURE;
}
- if ((ctx->count < ctx->u.rep->pattern[2] ||
+ if ((ctx->count < (Py_ssize_t) ctx->u.rep->pattern[2] ||
ctx->u.rep->pattern[2] == SRE_MAXREPEAT) &&
state->ptr != ctx->u.rep->last_ptr) {
/* we may have enough matches, but if we can
@@ -1243,7 +1243,7 @@ entrance:
TRACE(("|%p|%p|MIN_UNTIL %d %p\n", ctx->pattern,
ctx->ptr, ctx->count, ctx->u.rep->pattern));
- if (ctx->count < ctx->u.rep->pattern[1]) {
+ if (ctx->count < (Py_ssize_t) ctx->u.rep->pattern[1]) {
/* not enough matches */
ctx->u.rep->count = ctx->count;
DO_JUMP(JUMP_MIN_UNTIL_1, jump_min_until_1,
@@ -1272,7 +1272,7 @@ entrance:
LASTMARK_RESTORE();
- if ((ctx->count >= ctx->u.rep->pattern[2]
+ if ((ctx->count >= (Py_ssize_t) ctx->u.rep->pattern[2]
&& ctx->u.rep->pattern[2] != SRE_MAXREPEAT) ||
state->ptr == ctx->u.rep->last_ptr)
RETURN_FAILURE;