aboutsummaryrefslogtreecommitdiffstats
path: root/xmlregexp.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2007-08-28 17:33:45 +0000
committerDaniel Veillard <veillard@src.gnome.org>2007-08-28 17:33:45 +0000
commitc821e03c66873f74d1eda5c6b4a7b0bb9ca9105b (patch)
tree6a07c40c8147613033f4aab0f5d975044b822186 /xmlregexp.c
parentec72008ba71615131235222fd3d8765b95e46e4f (diff)
downloadandroid_external_libxml2-c821e03c66873f74d1eda5c6b4a7b0bb9ca9105b.tar.gz
android_external_libxml2-c821e03c66873f74d1eda5c6b4a7b0bb9ca9105b.tar.bz2
android_external_libxml2-c821e03c66873f74d1eda5c6b4a7b0bb9ca9105b.zip
another nasty regexp case fixed. added to regression suite Daniel
* xmlregexp.c: another nasty regexp case fixed. * test/regexp/ranges2 result/regexp/ranges2: added to regression suite Daniel svn path=/trunk/; revision=3658
Diffstat (limited to 'xmlregexp.c')
-rw-r--r--xmlregexp.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/xmlregexp.c b/xmlregexp.c
index 1f1a1cce..2bce3670 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -1610,7 +1610,7 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
/* ???? For some reason it seems we never reach that
case, I suppose this got optimized out before when
building the automata */
-
+ copy = xmlRegCopyAtom(ctxt, atom);
copy = xmlRegCopyAtom(ctxt, atom);
if (copy == NULL)
return(-1);
@@ -1711,9 +1711,11 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1);
break;
case XML_REGEXP_QUANT_RANGE:
+#if DV_test
if (atom->min == 0) {
xmlFAGenerateEpsilonTransition(ctxt, from, to);
}
+#endif
break;
default:
break;
@@ -3211,12 +3213,22 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) {
* this is a multiple input sequence
* If there is a counter associated increment it now.
* before potentially saving and rollback
+ * do not increment if the counter is already over the
+ * maximum limit in which case get to next transition
*/
if (trans->counter >= 0) {
- if (exec->counts == NULL) {
+ xmlRegCounterPtr counter;
+
+ if ((exec->counts == NULL) ||
+ (exec->comp == NULL) ||
+ (exec->comp->counters == NULL)) {
exec->status = -1;
goto error;
}
+ counter = &exec->comp->counters[trans->counter];
+ if (exec->counts[trans->counter] >= counter->max)
+ continue; /* for loop on transitions */
+
#ifdef DEBUG_REGEXP_EXEC
printf("Increasing count %d\n", trans->counter);
#endif
@@ -3312,10 +3324,18 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) {
xmlFARegExecSave(exec);
}
if (trans->counter >= 0) {
- if (exec->counts == NULL) {
- exec->status = -1;
+ xmlRegCounterPtr counter;
+
+ /* make sure we don't go over the counter maximum value */
+ if ((exec->counts == NULL) ||
+ (exec->comp == NULL) ||
+ (exec->comp->counters == NULL)) {
+ exec->status = -1;
goto error;
}
+ counter = &exec->comp->counters[trans->counter];
+ if (exec->counts[trans->counter] >= counter->max)
+ continue; /* for loop on transitions */
#ifdef DEBUG_REGEXP_EXEC
printf("Increasing count %d\n", trans->counter);
#endif