1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-23 01:52:48 +03:00

Fix range quantifier on subregex

Make sure to add counted exit transitions before other counter
transitions. Otherwise, we won't backtrack correctly.

Fixes #65.
This commit is contained in:
Nick Wellnhofer
2021-12-20 00:31:41 +01:00
parent 48ed5a74bd
commit 382fb056b5
3 changed files with 7 additions and 3 deletions

View File

@@ -1693,12 +1693,12 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
counter = xmlRegGetCounter(ctxt);
ctxt->counters[counter].min = atom->min - 1;
ctxt->counters[counter].max = atom->max - 1;
/* count the number of times we see it again */
xmlFAGenerateCountedEpsilonTransition(ctxt, atom->stop,
atom->start, counter);
/* allow a way out based on the count */
xmlFAGenerateCountedTransition(ctxt, atom->stop,
newstate, counter);
/* count the number of times we see it again */
xmlFAGenerateCountedEpsilonTransition(ctxt, atom->stop,
atom->start, counter);
/* and if needed allow a direct exit for 0 */
if (atom->min == 0)
xmlFAGenerateEpsilonTransition(ctxt, atom->start0,