@@ -2782,6 +2782,7 @@ uint32_t *previous_callout = NULL;
2782
2782
uint32_t * parsed_pattern = cb -> parsed_pattern ;
2783
2783
uint32_t * parsed_pattern_end = cb -> parsed_pattern_end ;
2784
2784
uint32_t * this_parsed_item = NULL ;
2785
+ uint32_t * prev_parsed_item = NULL ;
2785
2786
uint32_t meta_quantifier = 0 ;
2786
2787
uint32_t add_after_mark = 0 ;
2787
2788
uint32_t xoptions = cb -> cx -> extra_options ;
@@ -2867,11 +2868,10 @@ while (ptr < ptrend)
2867
2868
uint32_t xset , xunset , * xoptset ;
2868
2869
uint32_t terminator ;
2869
2870
uint32_t prev_meta_quantifier ;
2870
- uint32_t * prev_parsed_item = this_parsed_item ;
2871
2871
BOOL prev_okquantifier ;
2872
2872
PCRE2_SPTR tempptr ;
2873
2873
PCRE2_SIZE offset ;
2874
-
2874
+
2875
2875
if (parsed_pattern >= parsed_pattern_end )
2876
2876
{
2877
2877
errorcode = ERR63 ; /* Internal error (parsed pattern overflow) */
@@ -2883,10 +2883,17 @@ while (ptr < ptrend)
2883
2883
errorcode = ERR19 ;
2884
2884
goto FAILED ; /* Parentheses too deeply nested */
2885
2885
}
2886
-
2887
- /* Remember where this item started */
2888
2886
2889
- this_parsed_item = parsed_pattern ;
2887
+ /* If the last time round this loop something was added, parsed_pattern will
2888
+ no longer be equal to this_parsed_item. Remember where the previous item
2889
+ started and reset for the next item. Note that sometimes round the loop,
2890
+ nothing gets added (e.g. for ignored white space). */
2891
+
2892
+ if (this_parsed_item != parsed_pattern )
2893
+ {
2894
+ prev_parsed_item = this_parsed_item ;
2895
+ this_parsed_item = parsed_pattern ;
2896
+ }
2890
2897
2891
2898
/* Get next input character, save its position for callout handling. */
2892
2899
@@ -3440,7 +3447,8 @@ while (ptr < ptrend)
3440
3447
3441
3448
/* ---- Quantifier post-processing ---- */
3442
3449
3443
- /* Check that a quantifier is allowed after the previous item. */
3450
+ /* Check that a quantifier is allowed after the previous item. This
3451
+ guarantees that there is a previous item. */
3444
3452
3445
3453
CHECK_QUANTIFIER :
3446
3454
if (!prev_okquantifier )
0 commit comments