mirror of https://github.com/python/cpython.git
Fixing bug #1072259 in SRE.
This commit is contained in:
parent
4901a1f267
commit
166878f544
|
@ -1024,9 +1024,10 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
|
||||||
|
|
||||||
state->ptr = ctx->ptr;
|
state->ptr = ctx->ptr;
|
||||||
|
|
||||||
ctx->count = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]);
|
ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]);
|
||||||
RETURN_ON_ERROR(ctx->count);
|
RETURN_ON_ERROR(ret);
|
||||||
|
DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);
|
||||||
|
ctx->count = ret;
|
||||||
ctx->ptr += ctx->count;
|
ctx->ptr += ctx->count;
|
||||||
|
|
||||||
/* when we arrive here, count contains the number of
|
/* when we arrive here, count contains the number of
|
||||||
|
@ -1110,13 +1111,14 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
|
||||||
ctx->count = 0;
|
ctx->count = 0;
|
||||||
else {
|
else {
|
||||||
/* count using pattern min as the maximum */
|
/* count using pattern min as the maximum */
|
||||||
ctx->count = SRE_COUNT(state, ctx->pattern+3,
|
ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[1]);
|
||||||
ctx->pattern[1]);
|
RETURN_ON_ERROR(ret);
|
||||||
RETURN_ON_ERROR(ctx->count);
|
DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);
|
||||||
if (ctx->count < (int) ctx->pattern[1])
|
if (ret < (int) ctx->pattern[1])
|
||||||
/* didn't match minimum number of times */
|
/* didn't match minimum number of times */
|
||||||
RETURN_FAILURE;
|
RETURN_FAILURE;
|
||||||
/* advance past minimum matches of repeat */
|
/* advance past minimum matches of repeat */
|
||||||
|
ctx->count = ret;
|
||||||
ctx->ptr += ctx->count;
|
ctx->ptr += ctx->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1140,6 +1142,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
|
||||||
state->ptr = ctx->ptr;
|
state->ptr = ctx->ptr;
|
||||||
ret = SRE_COUNT(state, ctx->pattern+3, 1);
|
ret = SRE_COUNT(state, ctx->pattern+3, 1);
|
||||||
RETURN_ON_ERROR(ret);
|
RETURN_ON_ERROR(ret);
|
||||||
|
DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
break;
|
break;
|
||||||
assert(ret == 1);
|
assert(ret == 1);
|
||||||
|
|
Loading…
Reference in New Issue